Merry Christmas

  • Comments posted to this topic are about the item Merry Christmas

  • Thanks! That is nice. I understand polygons with geometry, but can you please explain how you set the colors? Also, did you add the FROM sys.messages simply to get the first polygon entry to go in 29 times, or was there something else you were doing there?

    Thanks again.

    Ann

  • annjunk (12/25/2015)


    Thanks! That is nice. I understand polygons with geometry, but can you please explain how you set the colors? Also, did you add the FROM sys.messages simply to get the first polygon entry to go in 29 times, or was there something else you were doing there?

    Thanks again.

    Ann

    That's exactly correct. The "sys.messages" table was simply used as a "row source" (some of us call it a "pseudo-cursor") to rapidly "loop" through the colors. Here's another take on it using a Nested While Loop.

    https://alastaira.wordpress.com/2011/03/31/more-drawing-fun-with-sql-server/

    As a bit of a sidebar, I think it's a real shame that MS didn't allow for more discreet color control and non-transparent colors. It would have been a whole lot more useful that way.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • For a more Yellow star (although terribly washed out thanks to transparency)...

    DECLARE @g TABLE (g GEOMETRY, ID INT IDENTITY(1,1));

    -- Adjust Color

    INSERT INTO @g(g) SELECT TOP 29 CAST('POLYGON((0 0, 0 0.0000001, 0.0000001 0.0000001, 0 0))' as geometry) FROM sys.messages;

    -- Build Christmas Tree

    INSERT INTO @g(g) VALUES (CAST('POLYGON((120 60,800 60,450 780, 120 60 ))' as GEOMETRY))

    INSERT INTO @g(g) VALUES (CAST('POLYGON((440 0,440 60, 460 60, 460 0, 440 0))' AS GEOMETRY))

    -- Adjust Color

    INSERT INTO @g(g) SELECT TOP 1 CAST('POLYGON((0 0, 0 0.0000001, 0.0000001 0.0000001, 0 0))' as geometry) FROM sys.messages;

    -- Build a Star

    INSERT INTO @g(g) VALUES (CAST('POLYGON ((450 910, 465.716 861.631, 516.574 861.631, 475.429 831.738, 491.145 783.369, 450 813.262, 408.855 783.369, 424.571 831.738, 383.426 861.631, 434.284 861.631, 450 910))' as geometry));

    SELECT g FROM @g ORDER BY ID;

    GO

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Thanks for the Christmas gift.

  • Thanks. One more quick question, is there a document any where with the colors used and the order when adding polygons, or does everyone just play with it in their own to figure it out?

  • Steve, that's far too much free time on your hands!

    Here's hoping you had a great holiday. 🙂

    -----
    [font="Arial"]Knowledge is of two kinds. We know a subject ourselves or we know where we can find information upon it. --Samuel Johnson[/font]

  • annjunk (12/27/2015)


    Thanks. One more quick question, is there a document any where with the colors used and the order when adding polygons, or does everyone just play with it in their own to figure it out?

    Yes. I posted it previously on this thread but here it is again.

    https://alastaira.wordpress.com/2011/03/31/more-drawing-fun-with-sql-server/

    And to say it again, considering the washed out colors and the lack of direct color selection, I hate it.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Ooo, thanks for posting Steve, a lovely gentle brain warmer after the cold xmas break!

    To add stronger, less washed-out colours, I also added a couple of repeating layers of polygons :-

    DECLARE @g TABLE (g GEOMETRY, ID INT IDENTITY(1,1));

    -- Adjust Color

    INSERT INTO @g(g) SELECT TOP 29 CAST('POLYGON((0 0, 0 0.0000001, 0.0000001 0.0000001, 0 0))' as geometry) FROM sys.messages;

    -- Build Christmas Tree

    INSERT INTO @g(g) VALUES (CAST('POLYGON((120 60,800 60,450 780, 120 60 ))' as GEOMETRY))

    INSERT INTO @g(g) SELECT TOP 17 CAST('POLYGON((0 0, 0 0.0000001, 0.0000001 0.0000001, 0 0))' as geometry) FROM sys.messages;

    INSERT INTO @g(g) VALUES (CAST('POLYGON((120 60,800 60,450 780, 120 60 ))' as GEOMETRY))

    INSERT INTO @g(g) VALUES (CAST('POLYGON((440 0,440 60, 460 60, 460 0, 440 0))' AS GEOMETRY))

    -- Adjust Color

    INSERT INTO @g(g) SELECT TOP 7 CAST('POLYGON((0 0, 0 0.0000001, 0.0000001 0.0000001, 0 0))' as geometry) FROM sys.messages;

    -- Build a Star

    INSERT INTO @g(g) VALUES (CAST('POLYGON ((450 910, 465.716 861.631, 516.574 861.631, 475.429 831.738, 491.145 783.369, 450 813.262, 408.855 783.369, 424.571 831.738, 383.426 861.631, 434.284 861.631, 450 910))' as geometry));

    INSERT INTO @g(g) SELECT TOP 3 CAST('POLYGON((0 0, 0 0.0000001, 0.0000001 0.0000001, 0 0))' as geometry) FROM sys.messages;

    INSERT INTO @g(g) VALUES (CAST('POLYGON ((450 910, 465.716 861.631, 516.574 861.631, 475.429 831.738, 491.145 783.369, 450 813.262, 408.855 783.369, 424.571 831.738, 383.426 861.631, 434.284 861.631, 450 910))' as geometry));

    SELECT g FROM @g ORDER BY ID;

    GO

    Happy New Year!

    Dawn.

    (PS I Haven't had as much fun since I tried to animate an elephant made from polygons in Lotus Freelance (DOS version) back in around 1988 !! haha! )

  • Thanks Jeff. I somehow overlooked the link the first time. Definitely a good article to store in my "Cool Stuff" folder even though the feature isn't as good as it could be.

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply