MapObject Control Symbol Drawing
Beijing Zhang Songwei
Zswzwy@163.com
In MO, you can draw some specific symbols yourself on the layer to identify special points. For example: maps from all places, identify some buildings, subways, schools, etc., which can be implemented with MO's TrackingLayer.
First join the member variable in your view class: cmotrackinglayer m_tlayer;
Then, each map layer is a letter to TRACKINGLAYER, you have to get them, just like this:
m_tlayer = m_map.gettrackinglayer ();
Ok, let's start to add a sign on the map. Mo point representation, I have already mentioned in front, below you want to create some points, and convert them into map coordinates, and use the cmotrackinglayer class's AddEvent () method to draw them into Mo map.
For (int i = 0; i { CMOPOINT MAPPT (m_map.tomappoint (m_point.get (i), m_point.get (i))); m_tlayer = m_map.gettrackinglayer (); m_tlayer.addevent (MAPPT, 0); } Ok, I have already visited a lot of rectangles on your map. Some people may ask, what is the second parameter of the addEvent () method? Ok, I am going to say this problem. In Mo, there is a style in each point, we call Symbo Style. You can set it yourself, style, size, color, etc. m_tlayer.setsymbolcount (3); // Sets the number of SYMBOs to 3. The three SYMBOs can be set below. M_Tlayer.getsymbol (0) .SetSymboltype (MopointSymbol); m_tlayer.getsymbol (0) .SetStyle (MOCIRCLEMARKER); m_tlayer.getsymbol (0) .SetColor (RGB (255, 240, 255)); M_Tlayer.getsymbol (0) .Setsize (6); M_Tlayer.getsymbol (1) .SetSymboltype (MopointSymbol); m_tlayer.getsymbol (1) .SetStyle (MOSQUAREMARKER); m_tlayer.getsymbol (1) .SetColor (RGB (255, 240, 255)); m_tlayer.getsymbol (1) .Setsize (6); m_tlayer.getsymbol (2) .Setsymboltype (MopointSymbol); M_Tlayer.getsymbol (2) .SetStyle (MotriangleMarker); M_Tlayer.getsymbol (2) .SetColor (RGB (255, 240, 255)); M_Tlayer.getsymbol (2) .Setsize (6); Related styles I will give it later, or view MO help. Just now, I just added a lot, and the features of TrackingLayer are not only just. It can add some circles, rectangles, polygons, and more. These can be expressed by setting SYMBO style. Symbo related types: MofillSymbol, Molinesymbol, MopointSymbol is polygons, lines, points. Various styles of Symbo: point: MOCIRCLEMARKER 0 CIRCLEMOSQUAREMARKER 1 SQUARE MotriangleMarker 2 Triangle Mocrossmarker 3 cross MOTRUETYPEMARKER 4 TRUETYPE line: Mosolidline 0 Solid Line Modashline 1 Dash Line MODOTLINE 2 DOT LINE ModashDotline 3 Dash Dot Line ModashDotdotline 4 Dash Dot Dot Line Polygon: Mosolidfill 0 Solid Motransparentfill 1 Transparent Mohorizontalfill 2 Horizontal Moverticalfill 3 Vertical MOUPWARDDIAGONALFILL 4 UPWARD DIAGONAL ModownWardDiagonalfill 5 Downward Diagonal Mocrossfill 6 Cross Modiagonalcrossfill 7 Diagonal Cross Molightgrayfill 8 Light Gray Fill MOGRAYFILL 9 GRAY FILL Modarkgrayfill 10 Darkgray Fill Also you can customize the SYMBO type. TRAKCINGLAYER color list: MOBLACK 0x0 Black Mored 0xff Mogreen 0xff00 Green moblue 0xff0000 Blue Momagenta 0xff00ff Magenta Mocyan 0xffff00 CYAN MOWHITE 0xFFFFFFFFFF Molightgray 12632256 LightGray MODARKGRAY 4210752 DARKGRAY MOGRAY 8421504 Gray MopaleEllow 13697023 Pale Yellow Molightyellow 8454143 Light Yellow Moyellow 65535 Yellowmolimegreen 12639424 Lime Green Moteal 8421440 TEAL Modarkgreen 16384 Dark Green Momaroon 128 Maroon Mopurple 8388736 PURPLE Moorge 33023 Orange Mokhaki 7051175 Khaki MOOLIVE 32896 OLIVE MobrowN 4210816 Brown Monavy 8404992 NAVY Ok, check your results. In the next time I will introduce how to create a new layer using the program, see it next time.