As we travel around the world, we’re looking at maps every single day. And being a Visio Guy, this naturally causes ideas to formulate in the old noggin. You may have seen and enjoyed the various map downloads from Visio Guy, but today, we’ve got something a little bit different.
I hope you’ll get a kick out of today’s SmartShape: the Multi-Earth Shape. This little bugger lets you choose four views and four color schemes, all with a click of the mouse!
Change Your World
A picture is worth a thousand worlds. Let’s have a look at what you can do with this SmartShape:
You can choose from four views: New World, Old World, Down Under, or Australasia…
…and you can choose from four color schemes: Classic, Subtle, Antique, and Black & White.
The shape is easily configurable using a dual-mode technique. You can either right-click the shape to set the view and the colors, or you can use the Custom Properties (Shape Data) dialog and anchor-bar window.
Beneath the Mantel
I won’t describe every single technical aspect of the Multi-Earth shape, but I thought I’d mention a few tidbits for those of you who are really into Visio development.
After wasting investing a lot of time tracing the outlines of various views of the Earth, I combined (Shape > Operations > Combine) all the islands, countries, and continents into into single shapes. This simplified the task of making a multi-shape, but I still had a LOT of ShapeSheet Geometry sections and rows. These slowed performance, and made wading through the lengthy ShapeSheet rather tedious.
So I used the Polyline Shape Maker to reduce all the geometry sections to single rows, with big, long POLYLINE functions. Zap! Pow! Every Geometry section was now just two rows long!
The four view-shapes could then be grouped together, along with a background circle. Custom properties, User-cells, and Actions were added to the new group. In order to show or hide each view, we first added the User.isHidden cell to each sub-shape, which reacted indirectly to the value of a Prop.View in the group. Then we set the formula for every single Geometry.NoShow cell to refer to this user cell. Since the view sub-shapes had many, many Geometry sections, I used some VBA code to ease the process. You can find out more about various ways to hide shapes or parts of shapes in the article: The Hidden World of Visio Shapes.
The following code snippet adds two user-cells to the selected shape, then sets every GeometryN.NoShow cell with the formula “User.isHidden”. Perhaps you’ll find this code snippet interesting and useful!
Sub SetupMultiShapeItem() Const UserIndex$ = "User.index" Const Index$ = "index" Const UserIsHidden$ = "User.isHidden" Const IsHidden$ = "isHidden" Dim shp As Visio.Shape shp = Visio.ActiveWindow.Selection(1) If shp Is Nothing Then Exit Sub If shp.CellExists(UserIndex$, _ Visio.VisExistsFlags.visExistsAnywhere) = False Then Call shp.AddNamedRow( _ Visio.VisSectionIndices.visSectionUser, Index$, 0) End If If shp.CellExists(UserIsHidden$, _ Visio.VisExistsFlags.visExistsAnywhere) = False Then Call shp.AddNamedRow( _ Visio.VisSectionIndices.visSectionUser, IsHidden$, 0) End If Dim i As Integer, iGeoCt As Integer iGeoCt = shp.GeometryCount For i = 1 To iGeoCt shp.Cells("Geometry" & i & ".NoShow").FormulaForceU = UserIsHidden$ Next i End Sub
I hope you enjoy the Multi-Earth Shape!