taibc

How to get/change line style scale factor of Line ?

Discussion created by taibc on Aug 8, 2013
Hi everyone,

I am trying to read custom lines from the dgn file and draw it into MapControl.

But I don't know how get/set and change line style scale factor of Line ?

Please see this link for more detail about scale factor http://communities.bentley.com/products/microstation/w/microstation__wiki/setting-linestyle-scale-in-microstation-v8-cs.aspx

And I used below codes to draw my lines:

IGraphicsContainer oGraphics = map as IGraphicsContainer;
            ILineElement lineElement;
            ESRI.ArcGIS.Display.ICartographicLineSymbol cartographicLineSymbolCls;

            IElement element = null;

            IPoint fromPoint;
            IPoint toPoint;

            IPolyline oPolyLine = new PolylineClass();

            double dentaX = x2 - x1;
            double dentaY = y1 - y2;

            double x0 = x1; 
            double y0 = y1;
            double x02 = 0, y02 = 0;
          
            double duongCheo = Math.Sqrt(dentaX * dentaX + dentaY * dentaY);
            double khoangCach = 0;
            double cosanpha = dentaX / duongCheo;
            double sinanpha = dentaY / duongCheo;
            double doDaiNetLien = 1.5;
          
            while (khoangCach < duongCheo)
            {
                
                fromPoint = new PointClass();
                toPoint = new PointClass();

                fromPoint.X = x0;
                fromPoint.Y = y0;
                doDaiNetLien = (doDaiNetLien + khoangCach) < duongCheo ? doDaiNetLien : (duongCheo - khoangCach);
                x02 = fromPoint.X + cosanpha * doDaiNetLien;
                y02 = fromPoint.Y - sinanpha * doDaiNetLien;

                toPoint.X = x02;
                toPoint.Y = y02;

                cartographicLineSymbolCls = new
                ESRI.ArcGIS.Display.CartographicLineSymbolClass();
                cartographicLineSymbolCls.Width = lineWeight + 0.1;
                cartographicLineSymbolCls.Cap = ESRI.ArcGIS.Display.esriLineCapStyle.esriLCSButt;
               
                cartographicLineSymbolCls.Join = esriLineJoinStyle.esriLJSBevel;
                lineElement = new LineElementClass();
                
                lineElement.Symbol = cartographicLineSymbolCls;
                oPolyLine.FromPoint = fromPoint;
                oPolyLine.ToPoint = toPoint;
               
                element = (IElement)lineElement;
                element.Geometry = oPolyLine;

                oGraphics.AddElement(element, 0);
                
                x0 = x02 + cosanpha * 0.8;
                y0 = y02 - sinanpha * 0.8;
                khoangCach += doDaiNetLien + 0.8;

            }

            IActiveView oActiveView = map as IActiveView;
            oActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);


Thanks and best regards,

Tai

Outcomes