Ejemplo n.º 1
0
        public void UpdateDrawables(
            RenderedEntityInfo renderedEntityInfo,
            System.Action updateDrawables,
            System.Action <IWireframeGraphicsFactory2> graphicsFactoryWrapper)
        {
            if (!this.bool_0)
            {
                throw new Exception("Property AreDrawablesUpdateable is false.");
            }
            List <WpfWireframeGraphics3D.Class451> class451List;

            if (!this.dictionary_0.TryGetValue(renderedEntityInfo.Entity, out class451List))
            {
                return;
            }
            WpfWireframeGraphics3D.Class451[] array           = class451List.ToArray();
            WpfWireframeGraphics3D.Class452   graphicsFactory = (WpfWireframeGraphics3D.Class452) this.CreateGraphicsFactory();
            if (graphicsFactoryWrapper != null)
            {
                graphicsFactoryWrapper((IWireframeGraphicsFactory2)graphicsFactory);
            }
            foreach (WpfWireframeGraphics3D.Class451 entityDrawablesInfo in array)
            {
                if (entityDrawablesInfo.Matches(renderedEntityInfo))
                {
                    this.RemoveDrawables(entityDrawablesInfo, true);
                    graphicsFactory.CurrentColoredDrawableNode  = new LinkedListNodeRef <Interface37>(entityDrawablesInfo.EntityDrawableNode.List, entityDrawablesInfo.EntityDrawableNode);
                    graphicsFactory.CurrentEntityDrawablesInfo  = entityDrawablesInfo.Parent;
                    graphicsFactory.ExistingEntityDrawablesInfo = entityDrawablesInfo;
                    updateDrawables();
                }
            }
        }
Ejemplo n.º 2
0
 public bool Matches(RenderedEntityInfo renderedEntityInfo)
 {
     if (renderedEntityInfo.Entity != this.dxfEntity_0)
     {
         return(false);
     }
     if (this.class451_0 == null && renderedEntityInfo.Parent == null)
     {
         return(true);
     }
     if (this.class451_0 != null && renderedEntityInfo.Parent != null)
     {
         return(this.class451_0.Matches(renderedEntityInfo.Parent));
     }
     return(false);
 }
Ejemplo n.º 3
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);
            mouseDown = false;

            //使用shift键放大缩小
            if (shiftPressed)
            {
                rectZoomInteractor.ProcessMouseButtonUp(new CanonicalMouseEventArgs(e), GetInteractionContext());
                rectZoomInteractor.Deactivate();
                Invalidate();
            }
            else
            {
                panInteractor.Deactivate();
                // Select entity at mouse location if mouse didn't move
                // and show entity in property grid.

                if (mouseClickLocation == e.Location)
                {
                    Point2D referencePoint = new Point2D(e.X, e.Y);
                    double  distance;
                    IList <RenderedEntityInfo> closestEntities =
                        EntitySelector.GetClosestEntities(
                            model,
                            GraphicsConfig.BlackBackgroundCorrectForBackColor,
                            gdiGraphics3D.To2DTransform,
                            referencePoint,
                            out distance
                            );
                    if (highlightedEntity != null)
                    {
                        IList <IWireframeDrawable> drawables       = graphicsCache.GetDrawables(highlightedEntity);
                        IWireframeGraphicsFactory  graphicsFactory = null;
                        gdiGraphics3D.UpdateDrawables(
                            highlightedEntity,
                            () => {
                            foreach (IWireframeDrawable drawable in drawables)
                            {
                                drawable.Draw(graphicsFactory);
                            }
                        },
                            o => graphicsFactory = o
                            );
                        Invalidate();
                        highlightedEntity = null;
                    }
                    if (closestEntities.Count > 0)
                    {
                        // Chose the last entity as it is drawn last, so will be on top.
                        highlightedEntity = closestEntities[closestEntities.Count - 1];
                        IList <IWireframeDrawable>           drawables = graphicsCache.GetDrawables(highlightedEntity);
                        WireframeGraphicsFactoryColorChanger graphicsFactoryColorChanger = null;
                        gdiGraphics3D.UpdateDrawables(
                            highlightedEntity,
                            () => {
                            foreach (IWireframeDrawable drawable in drawables)
                            {
                                drawable.Draw(graphicsFactoryColorChanger);
                            }
                        },
                            o => graphicsFactoryColorChanger = new WireframeGraphicsFactoryColorChanger(o, ColorChanger)
                            );
                        Invalidate();
                        DxfEntity entity = highlightedEntity.Entity;
                        OnEntitySelected(new EntityEventArgs(entity));
                    }
                }
            }
            currentInteractorDrawable = null;
        }