Beispiel #1
0
        // This is used by both line and rectangle specials.
        public static SymDef CreateLineSpecialSymDef(Map map, SymColor symColor, LineKind lineKind, float lineWidth, float gapSize, float dashSize, LineJoin lineJoin, LineCap lineCap)
        {
            string symbolId = map.GetFreeSymbolId(901);

            LineSymDef symdef;
            switch (lineKind) {
                case LineKind.Single:
                    symdef = new LineSymDef("Line", symbolId, symColor, lineWidth, lineJoin, lineCap);
                    break;

                case LineKind.Double:
                    LineSymDef.DoubleLineInfo doubleInfo = new LineSymDef.DoubleLineInfo();
                    doubleInfo.doubleLeftColor = doubleInfo.doubleRightColor = symColor;
                    doubleInfo.doubleThick = gapSize;
                    doubleInfo.doubleLeftWidth = doubleInfo.doubleRightWidth = lineWidth;
                    symdef = new LineSymDef("Line", symbolId, null, 0, lineJoin, lineCap);
                    symdef.SetDoubleLines(doubleInfo);
                    break;

                case LineKind.Dashed:
                    LineSymDef.DashInfo dashInfo = new LineSymDef.DashInfo();
                    dashInfo.dashLength = dashInfo.firstDashLength = dashInfo.lastDashLength = dashSize;
                    dashInfo.gapLength = gapSize;
                    symdef = new LineSymDef("Line", symbolId, symColor, lineWidth, lineJoin, lineCap);
                    symdef.SetDashInfo(dashInfo);
                    break;

                default: throw new ApplicationException("Unexpected line kind");
            }

            symdef.ToolboxImage = MapUtil.CreateToolboxIcon(Properties.Resources.LineSpecial_OcadToolbox);
            map.AddSymdef(symdef);
            return symdef;
        }
Beispiel #2
0
        protected override SymDef CreateSymDef(Map map, SymColor symColor)
        {
            LineSymDef symdef = new LineSymDef("Marked route", "705", symColor, NormalCourseAppearance.lineThickness * scaleRatio * appearance.lineWidth, LineJoin.Bevel, LineCap.Flat);

            LineSymDef.DashInfo dashes = new LineSymDef.DashInfo();
            dashes.dashLength = dashes.firstDashLength = dashes.lastDashLength = 2.0F * scaleRatio;
            dashes.gapLength = 0.5F * scaleRatio;
            dashes.minGaps = 1;
            symdef.SetDashInfo(dashes);

            symdef.ToolboxImage = MapUtil.CreateToolboxIcon(Properties.Resources.DashedLine_OcadToolbox);
            map.AddSymdef(symdef);
            return symdef;
        }