Example #1
0
        public static void TransposeToAllignPoints(this IView2D view, Point2D world, Point screen, AxisSelection mode = AxisSelection.Both)
        {
            Point2D screenPosWS = view.ScreenSpace2WorldSpace(screen.X, screen.Y);

            //nudge the screen so the mouse is zooming in on a point;
            Point2D nudge = screenPosWS - world;

            nudge *= view.Zoom;

            switch (mode)
            {
            case AxisSelection.Both:
                view.TransformX += nudge.X;
                view.TransformY += nudge.Y;
                break;

            case AxisSelection.Vertical:
                view.TransformY += nudge.Y;
                break;

            case AxisSelection.Horizontal:
                view.TransformX += nudge.X;
                break;
            }
        }
Example #2
0
        public static void Render(this IView2D view, Graphics g)
        {
            GDIPlusRenderer r = new GDIPlusRenderer(g);

            view.Render(r);
            r.Close();
        }
 protected override void OnKeyUp(KeyEventArgs e)
 {
     if (e.Key == Key.Escape)
     {
         if (_prj != null)
         {
             foreach (IView view in views.Where(x => x.baseType == ViewBaseType.D2))
             {
                 IView2D view2D = view as IView2D;
                 if (view2D.layers != null)
                 {
                     foreach (var layer in view2D.layers)
                     {
                         layer.highlightAll(false);
                     }
                 }
             }
         }
     }
     else if (e.Key == Key.Delete)
     {
         //RemoveDrawingObjects();
     }
     else if (e.Key == Key.N &&
              System.Windows.Input.Keyboard.Modifiers == ModifierKeys.Control)
     {
         // Ctrl+N
     }
     base.OnKeyUp(e);
 }
Example #4
0
        public void doLayerCompose(Bitmap below, IView2D view, IRenderer r)
        {
            r.DrawImage(below, 0, 0);

            if (Visable)
            {
                IRenderer r2 = IRendererFactory.GetPreferredRenderer(new Bitmap(below.Width, below.Height));
                Render(view, r2);
                Bitmap thisLayer = r2.RenderTargetAsGDIBitmap();

                switch (ComposeMode)
                {
                case ComposeModes.Normal:
                    if (Opacity < 1)
                    {
                        Bitmap thisLayerScaled = thisLayer.MultiplyOpacity(Opacity);
                        r.DrawImage(thisLayerScaled, 0, 0);
                    }
                    else
                    {
                        r.DrawImage(thisLayer, 0, 0);
                    }
                    break;

                case ComposeModes.Multiply:
                    goto case ComposeModes.Normal;    //TODO: ignoring ComposeModes for now

                case ComposeModes.Difference:
                    goto case ComposeModes.Normal;    //TODO: ignoring ComposeModes for now
                }

                //TODO: ignoring ComposeModes for now
            }
        }
Example #5
0
        public static Point2D ScreenSpace2WorldSpace(this IView2D view, double screenX, double screenY)
        {
            return(view.ScreenToWorldTransformMatrix.Transform(new Point2D(screenX, screenY)));
            //return WorldSpace2ScreenSpace(view, new Point2D(screenX, screenY));

            /*double x = screenX - view.TransformX;
             * double y = screenY - view.TransformY;
             * x /= view.Zoom;
             * y /= view.Zoom;
             * //Point2D p = new Point2D(x, y);
             * return p.RotateAboutOrigin(view.ClockwiseRotation);*/
            /*
             * //alternative
             * double x = screenX;
             * double y = screenY;
             *
             *
             *
             * //transform
             * x -= view.TransformX;
             * y -= view.TransformY;
             *
             * //rotate
             * Point2D p = new Point2D(x, y);
             * p = p.RotateAboutOrigin(view.ClockwiseRotation);
             * x = p.X;
             * y = p.Y;
             *
             * //scale
             * x /= view.Zoom;
             * y /= view.Zoom;
             *
             * return new Point2D(x, y);*/
        }
        public void Func(string Params)
        {
            //获取数据
            Project   _prj = Globals.project;
            Domain    _constructionDoamin2 = _prj.getDomain("Construction");
            DGObjects _tfsiDGObjects2      = _constructionDoamin2.DGObjectsList.Where(x => x.definition.Type == "TFSI").FirstOrDefault();

            //通知对象组改变事件
            Globals.mainFrame.DGObjectsSelectionChangedListener(this, new DGObjectsSelectionChangedEvent()
            {
                newObjs = _tfsiDGObjects2
            });

            //二维视图改变

            IMainFrame mainFrame = Globals.mainFrame;
            //获取要添加图元的视图view
            IView2D       _inputView       = (mainFrame.views.Where(x => x.name == "右幅剖面图").FirstOrDefault()) as IView2D;
            List <string> dynamiclayerlist = new List <string>()
            {
                "TFSI"
            };

            _inputView.Opendynamiclayers(dynamiclayerlist, "地质剖面");
            iS3Legned legeng_SPZL = new iS3Legned()
            {
                legndTitle    = "地质预报图例",
                iS3SymbolList = new List <iS3Symbol>()
                {
                    new iS3Symbol()
                    {
                        colorName = "Green", label = "地质预报", symbolType = SymbolType.Rectangle
                    }
                }
            };

            _inputView.holder.setlegend(legeng_SPZL);
            _inputView.holder.setLegendShow(true);

            _inputView       = (mainFrame.views.Where(x => x.name == "左幅剖面图").FirstOrDefault()) as IView2D;
            dynamiclayerlist = new List <string>()
            {
                "TFSI"
            };
            _inputView.Opendynamiclayers(dynamiclayerlist, "地质剖面");
            legeng_SPZL = new iS3Legned()
            {
                legndTitle    = "地质预报图例",
                iS3SymbolList = new List <iS3Symbol>()
                {
                    new iS3Symbol()
                    {
                        colorName = "Green", label = "地质预报", symbolType = SymbolType.Rectangle
                    }
                }
            };
            _inputView.holder.setlegend(legeng_SPZL);
            _inputView.holder.setLegendShow(true);
        }
Example #7
0
 public static TransMatrix2D CalculateWorldToScreenTransformMatrix(this IView2D view)
 {
     return(TransMatrix2D.FromTRS(new Point2D(view.TransformX, view.TransformY),
                                  view.ClockwiseRotation,
                                  //screenSpaceBounds.Middle(),
                                  Point2D.Origen,
                                  new Point2D(view.Zoom, view.Zoom)));
 }
Example #8
0
        public static Point2D WorldSpace2ScreenSpace(this IView2D view, Point2D worldSpace)
        {
            //view.WorldSpaceToScreenSpace

            /*Point2D trans = new Point2D(view.TransformX, view.TransformX);
             * Point2D scn = (worldSpace - trans) * view.Zoom;
             * return scn.RotateAboutOrigin(view.ClockwiseRotation);*/
            return(view.WorldToScreenTransformMatrix * worldSpace);
        }
        public void Func(string Params)
        {
            //二维视图改变

            IMainFrame mainFrame            = Globals.mainFrame;
            Project    _prj                 = Globals.project;
            Domain     _constructionDoamin2 = _prj.getDomain("Construction");
            DGObjects  _gprfDGObjects2      = _constructionDoamin2.DGObjectsList.Where(x => x.definition.Type == "TFSI").FirstOrDefault();

            Globals.mainFrame.DGObjectsSelectionChangedListener(null, new DGObjectsSelectionChangedEvent()
            {
                newObjs = _gprfDGObjects2
            });

            //获取要添加图元的视图view
            IView2D       _inputView       = (mainFrame.views.Where(x => x.name == "右幅剖面图").FirstOrDefault()) as IView2D;
            List <string> dynamiclayerlist = new List <string>()
            {
                "RiskIdfy"
            };

            _inputView.Opendynamiclayers(dynamiclayerlist, "施工进度");
            iS3Legned legeng_risk = new iS3Legned()
            {
                legndTitle    = "风险标识",
                iS3SymbolList = new List <iS3Symbol>()
                {
                    new iS3Symbol()
                    {
                        label = "风险点", symbolType = SymbolType.Icon, refPath = "riskidfy_alert.png"
                    }
                }
            };

            _inputView.holder.setlegend(legeng_risk);
            _inputView.holder.setLegendShow(true);

            _inputView       = (mainFrame.views.Where(x => x.name == "左幅剖面图").FirstOrDefault()) as IView2D;
            dynamiclayerlist = new List <string>()
            {
                "RiskIdfy"
            };
            _inputView.Opendynamiclayers(dynamiclayerlist, "施工进度");
            legeng_risk = new iS3Legned()
            {
                legndTitle    = "风险标识",
                iS3SymbolList = new List <iS3Symbol>()
                {
                    new iS3Symbol()
                    {
                        label = "风险点", symbolType = SymbolType.Icon, refPath = "riskidfy_alert.png"
                    }
                }
            };
            _inputView.holder.setlegend(legeng_risk);
            _inputView.holder.setLegendShow(true);
        }
Example #10
0
        //主程序加载完成之后执行
        private void MainFrame_projectLoaded(object sender, EventArgs e)
        {
            iS3Legned legeng_ACHE = new iS3Legned()
            {
                legndTitle    = "施工进度图例",
                iS3SymbolList = new List <iS3Symbol>()
                {
                    new iS3Symbol()
                    {
                        colorName = "Yellow", label = "初衬", symbolType = SymbolType.Rectangle
                    },
                    new iS3Symbol()
                    {
                        colorName = "GreenYellow", label = "二衬", symbolType = SymbolType.Rectangle
                    },
                    new iS3Symbol()
                    {
                        colorName = "Khaki", label = "仰拱", symbolType = SymbolType.Rectangle
                    },
                    new iS3Symbol()
                    {
                        label = "掌子面", symbolType = SymbolType.Icon, refPath = "redflag.png"
                    }
                    //new iS3Symbol(){label="图片",symbolType=SymbolType.Icon,refPath="照片.png"}
                }
            };

            IView2D _inputView = (Globals.mainFrame.views.Where(x => x.name == "右幅剖面图").FirstOrDefault()) as IView2D;

            _inputView.holder.setlegend(legeng_ACHE);
            _inputView.holder.setLegendShow(true);
            _inputView = (Globals.mainFrame.views.Where(x => x.name == "左幅剖面图").FirstOrDefault()) as IView2D;
            _inputView.holder.setlegend(legeng_ACHE);
            _inputView.holder.setLegendShow(true);

            try
            {
                DrawObjects drawObjects = new DrawObjects();
                drawObjects.DrawGRPF();

                drawObjects.DrawACHE();
                drawObjects.DrawACHE_EC();
                drawObjects.DrawACHE_YG();
                drawObjects.DrawACHE_ZZM();

                drawObjects.DrawCHAG();
                drawObjects.DrawTPSI();
                drawObjects.RiskIdentification();
                drawObjects.DrawTPZL();
                drawObjects.DrawSPZL();
            }
            catch (Exception ex)
            {
            }
            Globals.mainFrame.viewLoaded -= MainFrame_projectLoaded;
        }
Example #11
0
        public override void RenderGizmoLayer(IRenderer r, IView2D view)
        {
            //Determine worldspace location of the screen
            Rectangle2D    viewRec  = view.ScreenSpaceBounds;
            List <Point2D> viewArea = new List <Point2D>()
            {
                viewRec.TopLeft,
                viewRec.TopRight,
                viewRec.LowerLeft,
                viewRec.LowerRight
            };

            viewArea = view.ScreenToWorldTransformMatrix.Transform(viewArea);

            //Iteration bounds
            int xStart = (int)(Math.Floor(viewArea[0].X / XGapWorldSpace));
            int yStart = (int)(Math.Floor(viewArea[0].Y / YGapWorldSpace));
            int xEnd   = (int)(Math.Ceiling(viewArea[3].X / XGapWorldSpace));
            int yEnd   = (int)(Math.Ceiling(viewArea[3].Y / YGapWorldSpace));
            int xSteps = xEnd - xStart;
            int ySteps = yEnd - yStart;

            //Setup avis of screen in world space
            Point2D xAxis = (viewArea[1] - viewArea[0]);
            Point2D yAxis = (viewArea[2] - viewArea[0]);

            Point2D xAxisDir   = xAxis.UnitVector();
            Point2D yAxisDir   = yAxis.UnitVector();
            Point2D GridOrigin = (xStart * xAxis) + (yStart * yAxis);

            //color and fonts

            //draw the grid
            for (int y = yStart; y < yEnd; y++)
            {
                Point2D a = (y * YGapWorldSpace) * yAxisDir;
                a += new Point2D(viewArea[0].X, 0);
                Point2D b = a + xAxis;
                a = view.WorldToScreenTransformMatrix.Transform(a);
                b = view.WorldToScreenTransformMatrix.Transform(b);

                r.DrawLine(gridColor, 1, a, b);
            }

            for (int x = xStart; x < xEnd; x++)
            {
                Point2D a = (x * XGapWorldSpace) * xAxisDir;
                a += new Point2D(0, viewArea[0].Y);
                Point2D b = a + yAxis;
                a = view.WorldToScreenTransformMatrix.Transform(a);
                b = view.WorldToScreenTransformMatrix.Transform(b);

                r.DrawLine(gridColor, 1, a, b);
            }
        }
Example #12
0
        private static void getScreenPosForGridLineY(IView2D view, double YGapWorldSpace, List <Point2D> viewArea,
                                                     ref Point2D xAxis, ref Point2D yAxisDir, int y,
                                                     out Point2D a, out Point2D b)
        {
            double distWS = y * YGapWorldSpace;

            a  = (y * YGapWorldSpace) * yAxisDir;
            a += new Point2D(viewArea[0].X, 0);
            b  = a + xAxis;
            a  = view.WorldToScreenTransformMatrix.Transform(a);
            b  = view.WorldToScreenTransformMatrix.Transform(b);
        }
Example #13
0
        private static void getScreenPosForGridLineX(IView2D view, double XGapWorldSpace, List <Point2D> viewArea,
                                                     ref Point2D yAxis, ref Point2D xAxisDir, int x,
                                                     out Point2D a, out Point2D b)
        {
            double distWS = x * XGapWorldSpace;

            a  = distWS * xAxisDir;
            a += new Point2D(0, viewArea[0].Y);
            b  = a + yAxis;
            a  = view.WorldToScreenTransformMatrix.Transform(a);
            b  = view.WorldToScreenTransformMatrix.Transform(b);
        }
Example #14
0
        private static void getScreenSpaceGridGap(IView2D view, double XGapWorldSpace, double YGapWorldSpace, out double XGapScreenSpace, out double YGapScreenSpace)
        {
            XGapScreenSpace = XGapWorldSpace;
            YGapScreenSpace = YGapWorldSpace;
            view.WorldToScreenTransformMatrix.Transform(ref XGapScreenSpace, ref YGapScreenSpace);

            double originX = 0;
            double originY = 0;

            view.WorldToScreenTransformMatrix.Transform(ref originX, ref originY);
            XGapScreenSpace -= originX;
            YGapScreenSpace -= originY;

            XGapScreenSpace = Math.Abs(XGapScreenSpace);
            YGapScreenSpace = Math.Abs(YGapScreenSpace);
        }
Example #15
0
        public void Func(string Params)
        {
            //通知对象组改变事件
            Globals.mainFrame.DGObjectsSelectionChangedListener(this, new DGObjectsSelectionChangedEvent()
            {
                newObjs = null
            });
            //二维视图改变

            IMainFrame mainFrame = Globals.mainFrame;
            //获取要添加图元的视图view
            IView2D       _inputView       = (mainFrame.views.Where(x => x.name == "右幅剖面图").FirstOrDefault()) as IView2D;
            List <string> dynamiclayerlist = new List <string>();

            _inputView.Opendynamiclayers(dynamiclayerlist, "物探");
            _inputView.holder.setLegendShow(false);

            _inputView       = (mainFrame.views.Where(x => x.name == "左幅剖面图").FirstOrDefault()) as IView2D;
            dynamiclayerlist = new List <string>();
            _inputView.Opendynamiclayers(dynamiclayerlist, "物探");
            _inputView.holder.setLegendShow(false);
        }
Example #16
0
        public void Func(string Params)
        {
            if (_init == 0)
            {
                SetProgressEvent _event = new SetProgressEvent(UnityEventType.SetProgressEvent);
                _event.TunnelSectionList = new List <TunnelSection>();
                List <Tuple <string, string> > list = Globals.tunnelSectionList;
                foreach (var data in Globals.tunnelSectionList)
                {
                    _event.TunnelSectionList.Add(new TunnelSection()
                    {
                        startM = data.Item1, endM = data.Item2
                    });
                }
                _event.TunnelPointList = new List <string>();
                double zmax = 0; double zmin = 20000; double ymax = 0; double ymin = 20000;
                string zmaxStr = ""; string zminStr = ""; string ymaxStr = ""; string yminStr = "";
                foreach (string str in Globals.tunnelPosList)
                {
                    if (str.StartsWith("YK"))
                    {
                        double mi = getMileage(str);
                        if ((mi < 7000) && (mi > ymax))
                        {
                            ymax = mi; ymaxStr = str;
                        }
                        if ((mi > 7000) && (mi < ymin))
                        {
                            ymin = mi; yminStr = str;
                        }
                    }
                    if (str.StartsWith("ZK"))
                    {
                        double mi = getMileage(str);
                        if ((mi < 7000) && (mi > zmax))
                        {
                            zmax = mi; zmaxStr = str;
                        }
                        if ((mi > 7000) && (mi < zmin))
                        {
                            zmin = mi; zminStr = str;
                        }
                    }
                }
                _event.TunnelPointList.Add(ymaxStr);
                _event.TunnelPointList.Add(zmaxStr);
                _event.TunnelPointList.Add(yminStr);
                _event.TunnelPointList.Add(zminStr);
                U3DViewModel model = Globals.mainFrame.views.Where(x => x.baseType == ViewBaseType.D3).FirstOrDefault() as U3DViewModel;
                model.ExcuteCommand(JsonConvert.SerializeObject(_event));
            }
            else
            {
                _state = !_state;
                SetProgressEvent _event = new SetProgressEvent(UnityEventType.SetProgressEvent);
                _event.state = _state;
                U3DViewModel model = Globals.mainFrame.views.Where(x => x.baseType == ViewBaseType.D3).FirstOrDefault() as U3DViewModel;
                model.ExcuteCommand(JsonConvert.SerializeObject(_event));
            }
            _init++;

            Project   _prj = Globals.project;
            Domain    _constructionDoamin = _prj.getDomain("Construction");
            DGObjects _gprfDGObjects      = _constructionDoamin.DGObjectsList.Where(x => x.definition.Type == "ACHE").FirstOrDefault();

            Globals.mainFrame.DGObjectsSelectionChangedListener(this, new DGObjectsSelectionChangedEvent()
            {
                newObjs = _gprfDGObjects
            });
            //二维视图改变
            IMainFrame mainFrame = Globals.mainFrame;
            //获取要添加图元的视图view
            IView2D       _inputView       = (mainFrame.views.Where(x => x.name == "右幅剖面图").FirstOrDefault()) as IView2D;
            List <string> dynamiclayerlist = new List <string>()
            {
                "ACHE", "ACHE_EC", "ACHE_YG", "ACHE_ZZM"
            };

            _inputView.Opendynamiclayers(dynamiclayerlist, "施工进度");
            iS3Legned legeng_ACHE = new iS3Legned()
            {
                legndTitle    = "施工进度图例",
                iS3SymbolList = new List <iS3Symbol>()
                {
                    new iS3Symbol()
                    {
                        colorName = "Yellow", label = "初衬", symbolType = SymbolType.Rectangle
                    },
                    new iS3Symbol()
                    {
                        colorName = "GreenYellow", label = "二衬", symbolType = SymbolType.Rectangle
                    },
                    new iS3Symbol()
                    {
                        colorName = "Khaki", label = "仰拱", symbolType = SymbolType.Rectangle
                    },
                    new iS3Symbol()
                    {
                        label = "掌子面", symbolType = SymbolType.Icon, refPath = "redflag.png"
                    }
                    //new iS3Symbol(){label="图片",symbolType=SymbolType.Icon,refPath="照片.png"}
                }
            };

            _inputView.holder.setlegend(legeng_ACHE);
            _inputView.holder.setLegendShow(true);

            _inputView       = (mainFrame.views.Where(x => x.name == "左幅剖面图").FirstOrDefault()) as IView2D;
            dynamiclayerlist = new List <string>()
            {
                "ACHE", "ACHE_EC", "ACHE_YG", "ACHE_ZZM"
            };
            _inputView.Opendynamiclayers(dynamiclayerlist, "施工进度");
            legeng_ACHE = new iS3Legned()
            {
                legndTitle    = "施工进度图例",
                iS3SymbolList = new List <iS3Symbol>()
                {
                    new iS3Symbol()
                    {
                        colorName = "Yellow", label = "初衬", symbolType = SymbolType.Rectangle
                    },
                    new iS3Symbol()
                    {
                        colorName = "GreenYellow", label = "二衬", symbolType = SymbolType.Rectangle
                    },
                    new iS3Symbol()
                    {
                        colorName = "Khaki", label = "仰拱", symbolType = SymbolType.Rectangle
                    },
                    new iS3Symbol()
                    {
                        label = "掌子面", symbolType = SymbolType.Icon, refPath = "redflag.png"
                    }
                    //new iS3Symbol(){label="图片",symbolType=SymbolType.Icon,refPath="照片.png"}
                }
            };
            _inputView.holder.setlegend(legeng_ACHE);
            _inputView.holder.setLegendShow(true);
        }
Example #17
0
 public override void RenderGizmoLayer(IRenderer r, IView2D view)
 {
     RenderGizmoLayer(r, view, DistanceGridRenderLayer.All);
 }
Example #18
0
        public void RenderGizmoLayer(IRenderer r, IView2D view, DistanceGridRenderLayer layers)
        {
            double XGapScreenSpace;
            double YGapScreenSpace;

            getScreenSpaceGridGap(view, XGapWorldSpace, YGapWorldSpace, out XGapScreenSpace, out YGapScreenSpace);

            //Determine worldspace location of the screen
            Rectangle2D    viewRec  = view.ScreenSpaceBounds;
            List <Point2D> viewArea = new List <Point2D>()
            {
                viewRec.TopLeft,
                viewRec.TopRight,
                viewRec.LowerLeft,
                viewRec.LowerRight
            };

            viewArea = view.ScreenToWorldTransformMatrix.Transform(viewArea);

            //Iteration bounds
            int xStart = (int)(Math.Floor(viewArea[0].X / XGapWorldSpace));
            int yStart = (int)(Math.Floor(viewArea[0].Y / YGapWorldSpace));
            int xEnd   = (int)(Math.Ceiling(viewArea[3].X / XGapWorldSpace));
            int yEnd   = (int)(Math.Ceiling(viewArea[3].Y / YGapWorldSpace));
            int xSteps = xEnd - xStart;
            int ySteps = yEnd - yStart;

            //Setup avis of screen in world space
            Point2D xAxis = (viewArea[1] - viewArea[0]);
            Point2D yAxis = (viewArea[2] - viewArea[0]);

            Point2D xAxisDir   = xAxis.UnitVector();
            Point2D yAxisDir   = yAxis.UnitVector();
            Point2D GridOrigin = (xStart * xAxis) + (yStart * yAxis);

            //draw the grid
            Point2D a;
            Point2D b;

            int  NumberOfGridLinesThreshold = (int)(Math.Min(viewRec.Width, viewRec.Height) / 2);
            bool gridRenderIsSensible       = ((xSteps <= NumberOfGridLinesThreshold) && (ySteps <= NumberOfGridLinesThreshold));

            //lines
            if (ShowGridLines && ((layers & DistanceGridRenderLayer.Grid) != 0))
            {
                if (gridRenderIsSensible)
                {
                    for (int y = yStart; y < yEnd; y++)
                    {
                        getScreenPosForGridLineY(view, YGapWorldSpace, viewArea, ref xAxis, ref yAxisDir, y, out a, out b);
                        r.DrawLine(gridColor, 1, a, b);
                    }

                    for (int x = xStart; x < xEnd; x++)
                    {
                        getScreenPosForGridLineX(view, XGapWorldSpace, viewArea, ref yAxis, ref xAxisDir, x, out a, out b);
                        r.DrawLine(gridColor, 1, a, b);
                    }
                }
            }

            //rulers
            if ((layers & DistanceGridRenderLayer.Ruler) != 0)
            {
                Rectangle ssb            = view.ScreenSpaceBounds;
                int       gutterSizeTop  = 20;
                int       gutterSizeLeft = 40;

                //------------ LEFT GUTTER
                r.FillRectangle(Color.White, ssb.Left, ssb.Top + gutterSizeTop, gutterSizeLeft, ssb.Height - gutterSizeTop);
                r.DrawRectangle(Color.Black, 1, ssb.Left, ssb.Top + gutterSizeTop, gutterSizeLeft, ssb.Height - gutterSizeTop);

                //int pixelsSinceLastStringThreshold = 10;
                //int pixelPosOfLastString = 0;
                //int labelMod = (int)(Math.Max(YGapScreenSpace, 1)) / 5;
                //labelMod = Math.Max(labelMod, 1);
                int labelMod             = 1;
                int textDistanceInPixels = 15;
                while ((YGapScreenSpace * labelMod) < MaxSeenLabelSize.Height) //12
                {
                    //labelMod *= 10;
                    labelMod *= UnitMode.UsesFractions ? 2 : 10;
                }
                for (int y = yStart; y < yEnd; y++)
                {
                    getScreenPosForGridLineY(view, YGapWorldSpace, viewArea, ref xAxis, ref yAxisDir, y, out a, out b);

                    double distMesure = (y * YGapWorldSpace) / YWorldSpaceResolution.DotsPerMetre;
                    if ((y % labelMod) == 0)
                    {
                        r.DrawLine(Color.Black, 1, (int)gutterSizeLeft - 15, (int)a.Y, (int)gutterSizeLeft, (int)a.Y);

                        if (a.Y > (gutterSizeTop + 5))
                        {
                            bool    isMinor;
                            Point2D TextOffset;
                            string  rulertext = getRulerText(r, distMesure, out isMinor, out TextOffset, true);
                            r.DrawString(isMinor ? fmtMinor : fmtMajor, rulertext, (a + TextOffset).AsPoint());
                        }
                    }
                    else
                    {
                        r.DrawLine(Color.Black, 1, (int)gutterSizeLeft - 5, (int)a.Y, (int)gutterSizeLeft, (int)a.Y);
                    }
                }

                //------------ TOP GUTTER
                //fmt.printVertical = true;
                labelMod             = 1;
                textDistanceInPixels = UnitMode.UsesFractions ? 120 : 60;
                while ((XGapScreenSpace * labelMod) < MaxSeenLabelSize.Width) //30
                {
                    //labelMod *= (UnitMode.LastUnitModulus <= 1) ? 10 : UnitMode.LastUnitModulus;
                    labelMod *= UnitMode.UsesFractions ? 2 : 10;
                }

                r.FillRectangle(Color.White, ssb.Left, ssb.Top, ssb.Width, gutterSizeTop);
                r.DrawRectangle(Color.Black, 1, ssb.Left, ssb.Top, ssb.Width, gutterSizeTop);
                for (int x = xStart; x < xEnd; x++)
                {
                    getScreenPosForGridLineX(view, XGapWorldSpace, viewArea, ref yAxis, ref xAxisDir, x, out a, out b);

                    double distMesure = (x * XGapWorldSpace) / XWorldSpaceResolution.DotsPerMetre;
                    if ((x % labelMod) == 0) //labelMod = 5
                    {
                        r.DrawLine(Color.Black, 1, (int)a.X, (int)gutterSizeTop - 10, (int)a.X, (int)gutterSizeTop);
                        //if (gridRenderIsSensible)
                        {
                            /*
                             * string rulertext = UnitMode.GetDistanceString(Distance.FromMetres(distMesure), "?");
                             * bool isMinor = rulertext.StartsWith("?");
                             * rulertext = rulertext.TrimStart("?".ToCharArray());
                             *
                             * //Point2D TextOffset = new Point2D(-12, 2);
                             * Point2D TextOffset = new Point2D(-(r.MeasureString(rulertext, fmt.font).Width / 2), 2);
                             *
                             * r.DrawString(isMinor ? fmtMinor : fmt, rulertext, (a + TextOffset).AsPoint());*/

                            bool    isMinor;
                            Point2D TextOffset;
                            string  rulertext = getRulerText(r, distMesure, out isMinor, out TextOffset, false);
                            r.DrawString(isMinor ? fmtMinor : fmtMajor, rulertext, (a + TextOffset).AsPoint());
                        }
                    }
                    else
                    {
                        r.DrawLine(Color.Black, 1, (int)a.X, (int)gutterSizeTop - 3, (int)a.X, (int)gutterSizeTop);
                    }
                }

                //draw mouse location marker
                IEditableView2D ev = view as IEditableView2D;
                if (ev != null)
                {
                    Point2D pos = view.WorldToScreenTransformMatrix.Transform(ev.MousePosInWorldSpace);
                    //top
                    r.DrawLine(Color.Red, 1, (int)pos.X, (int)gutterSizeTop - 15, (int)pos.X, (int)gutterSizeTop);
                    //left
                    if (pos.Y > gutterSizeTop)
                    {
                        r.DrawLine(Color.Red, 1, (int)gutterSizeLeft - 10, (int)pos.Y, (int)gutterSizeLeft, (int)pos.Y);
                    }
                }
            }
        }
Example #19
0
 public bool IsHit(Point2D pos, IView2D view)
 {
     return((Pos - pos).Length() < ((1.0 / view.Zoom) * 8.0));
 }
Example #20
0
        public void Func(string Params)
        {
            //初始化三维事件
            U3DViewModel  model  = Globals.mainFrame.views.Where(x => x.baseType == ViewBaseType.D3).FirstOrDefault() as U3DViewModel;
            SetPointEvent _event = new SetPointEvent(UnityEventType.SetPointEvent);

            _event.Domain  = "Construction";
            _event.ObjType = "TPZL";
            _event.state   = state;
            state          = !state;
            //获取数据
            Project   _prj = Globals.project;
            Domain    _constructionDoamin2 = _prj.getDomain("Construction");
            DGObjects _gprfDGObjects2      = _constructionDoamin2.DGObjectsList.Where(x => x.definition.Type == "TPZL").FirstOrDefault();

            foreach (DGObject obj in _gprfDGObjects2.objContainer)
            {
                TPZL tpzl = JsonConvert.DeserializeObject <TPZL>(JsonConvert.SerializeObject(obj));
                if ((tpzl.TPZL_ZHQJ == null) || (tpzl.TPZL_ZHQJ.Length == 0))
                {
                    continue;
                }
                _event.TunnelPointList.Add(tpzl.TPZL_ZHQJ.Split('-')[0] + "#" + tpzl.ID.ToString());
                _event.ImageList.Add("Panel_Image");
            }
            model.ExcuteCommand(JsonConvert.SerializeObject(_event));
            //通知对象组改变事件
            Globals.mainFrame.DGObjectsSelectionChangedListener(this, new DGObjectsSelectionChangedEvent()
            {
                newObjs = _gprfDGObjects2
            });

            IMainFrame mainFrame = Globals.mainFrame;
            //获取要添加图元的视图view
            IView2D       _inputView       = (mainFrame.views.Where(x => x.name == "右幅剖面图").FirstOrDefault()) as IView2D;
            List <string> dynamiclayerlist = new List <string>()
            {
                "TPZL"
            };

            _inputView.Opendynamiclayers(dynamiclayerlist, "施工进度");
            iS3Legned legeng_TPZL = new iS3Legned()
            {
                legndTitle    = "图片资料图例",
                iS3SymbolList = new List <iS3Symbol>()
                {
                    new iS3Symbol()
                    {
                        label = "图片资料", symbolType = SymbolType.Icon, refPath = "picicon.png"
                    }
                }
            };

            _inputView.holder.setlegend(legeng_TPZL);
            _inputView.holder.setLegendShow(true);

            _inputView       = (mainFrame.views.Where(x => x.name == "左幅剖面图").FirstOrDefault()) as IView2D;
            dynamiclayerlist = new List <string>()
            {
                "TPZL"
            };
            _inputView.Opendynamiclayers(dynamiclayerlist, "施工进度");
            legeng_TPZL = new iS3Legned()
            {
                legndTitle    = "图片资料图例",
                iS3SymbolList = new List <iS3Symbol>()
                {
                    new iS3Symbol()
                    {
                        label = "图片资料", symbolType = SymbolType.Icon, refPath = "picicon.png"
                    }
                }
            };
            _inputView.holder.setlegend(legeng_TPZL);
            _inputView.holder.setLegendShow(true);
        }
Example #21
0
 public abstract void RenderGizmoLayer(IRenderer r, IView2D view);
Example #22
0
 public static Point2D ScreenSpace2WorldSpace(this IView2D view, Point screenSpace)
 {
     return(view.ScreenSpace2WorldSpace(screenSpace.X, screenSpace.Y));
 }
        public void Func(string Params)
        {
            //初始化三维事件
            U3DViewModel  model  = Globals.mainFrame.views.Where(x => x.baseType == ViewBaseType.D3).FirstOrDefault() as U3DViewModel;
            SetPointEvent _event = new SetPointEvent(UnityEventType.SetPointEvent);

            _event.Domain  = "Construction";
            _event.state   = state;
            state          = !state;
            _event.ObjType = "CHAG";
            //获取数据
            Project   _prj = Globals.project;
            Domain    _constructionDoamin2 = _prj.getDomain("Construction");
            DGObjects _gprfDGObjects2      = _constructionDoamin2.DGObjectsList.Where(x => x.definition.Type == "CHAG").FirstOrDefault();

            foreach (DGObject obj in _gprfDGObjects2.objContainer)
            {
                try
                {
                    CHAG chag = JsonConvert.DeserializeObject <CHAG>(JsonConvert.SerializeObject(obj));
                    if ((chag.CHAG_CHAI == null) || (chag.CHAG_CHAI.Length == 0))
                    {
                        continue;
                    }
                    _event.TunnelPointList.Add(chag.CHAG_CHAI.Split('-')[0] + "#" + chag.ID.ToString());
                    int before = findNum(chag.CHAG_PRIM);     //原来的衬砌类型
                    int after  = findNum(chag.CHAG_PRES);
                    if (before == after)
                    {
                        _event.ImageList.Add("Panel_Keep");
                    }
                    if (before > after)
                    {
                        _event.ImageList.Add("Panel_Decrease");
                    }
                    if (before < after)
                    {
                        _event.ImageList.Add("Panel_Increase");
                    }
                }
                catch (Exception ex)
                {
                }
            }
            model.ExcuteCommand(JsonConvert.SerializeObject(_event));
            //通知对象组改变事件
            Globals.mainFrame.DGObjectsSelectionChangedListener(this, new DGObjectsSelectionChangedEvent()
            {
                newObjs = _gprfDGObjects2
            });
            //二维视图改变

            IMainFrame mainFrame = Globals.mainFrame;
            //获取要添加图元的视图view 右幅
            IView2D       _inputView       = (mainFrame.views.Where(x => x.name == "右幅剖面图").FirstOrDefault()) as IView2D;
            List <string> dynamiclayerlist = new List <string>()
            {
                "CHAG"
            };

            _inputView.Opendynamiclayers(dynamiclayerlist, "施工进度");
            iS3Legned legeng_CHAG = new iS3Legned()
            {
                legndTitle    = "施工变更图例",
                iS3SymbolList = new List <iS3Symbol>()
                {
                    new iS3Symbol()
                    {
                        colorName = "HotPink", label = "施工变更", symbolType = SymbolType.Rectangle
                    }
                }
            };

            _inputView.holder.setlegend(legeng_CHAG);
            _inputView.holder.setLegendShow(true);

            //左幅
            _inputView       = (mainFrame.views.Where(x => x.name == "左幅剖面图").FirstOrDefault()) as IView2D;
            dynamiclayerlist = new List <string>()
            {
                "CHAG"
            };
            _inputView.Opendynamiclayers(dynamiclayerlist, "施工进度");
            legeng_CHAG = new iS3Legned()
            {
                legndTitle    = "施工变更图例",
                iS3SymbolList = new List <iS3Symbol>()
                {
                    new iS3Symbol()
                    {
                        colorName = "HotPink", label = "施工变更", symbolType = SymbolType.Rectangle
                    }
                }
            };
            _inputView.holder.setlegend(legeng_CHAG);

            _inputView.holder.setLegendShow(true);
        }
Example #24
0
 public static void AlterRotationAboutScreenMiddle(this IView2D view, double newRotation)
 {
 }
Example #25
0
 public abstract void Render(IView2D view, IRenderer r);
Example #26
0
 public MouseEventWorldSpace(int x, int y, MouseButtons button, IView2D view)
 {
     location    = view.ScreenSpace2WorldSpace(new Point2D(x, y));
     this.Button = button;
 }
Example #27
0
 public override void Render(IView2D view, WD_toolbox.Rendering.IRenderer r)
 {
     throw new NotImplementedException();
 }