protected override void AddToMap(Map map, SymDef symdef) { AreaSymbol sym = new AreaSymbol((AreaSymDef)symdef, path, 0, new PointF()); map.AddSymbol(sym); }
// Render the description into the given map at the given location in the given color. public void RenderToMap(Map map, SymColor color, PointF point, Dictionary<object, SymDef> dict) { IRenderer renderer = new MapRenderer(map, color, dict); // Set the correct transform. Matrix mat = new Matrix(); mat.Scale(1, -1); // flip Y axis. mat.Translate(point.X, -point.Y); renderer.Transform = mat; // White out the background. SizeF size = Measure(); PointKind[] kinds = { PointKind.Normal, PointKind.Normal, PointKind.Normal, PointKind.Normal, PointKind.Normal}; PointF[] pts = {Geometry.TransformPoint(new PointF(0, 0), mat), Geometry.TransformPoint(new PointF(size.Width, 0), mat),Geometry.TransformPoint(new PointF(size.Width, size.Height), mat), Geometry.TransformPoint(new PointF(0, size.Height), mat),Geometry.TransformPoint(new PointF(0, 0), mat) }; SymPath path = new SymPath(pts, kinds); AreaSymbol whiteout = new AreaSymbol((AreaSymDef) dict[CourseLayout.KeyWhiteOut], new SymPathWithHoles(path, null), 0, new PointF()); map.AddSymbol(whiteout); replaceMultiplySign = false; // OCAD doesn't handle the multiple character well. Render(renderer, new RectangleF(-100000, -100000, 200000, 200000), 0, description.Length); }
private static BaseSymbol GetSymbolFromType(int objectType, byte symType) { BaseSymbol bs = null; switch (objectType) { case 1: bs = new PointSymbol(); break; case 2: if (symType == 0x01) bs = new LineTextSymbol(); else bs = new LineSymbol(); break; case 3: bs = new AreaSymbol(); break; case 4: bs = new TextSymbol(); break; case 5: bs = new RectangleSymbol(); break; default: throw new ApplicationException("Unknown objectType: " + objectType); } return bs; }