コード例 #1
0
 public GeneralLengthAction(LengthProperty lengthProperty, GeoPoint fixPoint, IGeoObject ignoreSnap) : this(lengthProperty, fixPoint)
 {
     if (ignoreSnap != null)
     {
         base.IgnoreForSnap = new GeoObjectList(ignoreSnap);
     }
 }
コード例 #2
0
        public ColorSelectionProperty(object go, string propertyName, string resourceId, ColorList clrTable, ColorList.StaticFlags flags)
        {
            useFlags        = flags;
            flags           = clrTable.Usage;
            clrTable.Usage  = useFlags;
            base.resourceId = resourceId;
            colorList       = clrTable;
            choices         = clrTable.Names;

            objectWithProperty = go;
            propertyInfo       = objectWithProperty.GetType().GetProperty(propertyName);
            MethodInfo mi = propertyInfo.GetGetMethod();

            object[] prm           = new object[0];
            ColorDef selectedColor = (ColorDef)mi.Invoke(objectWithProperty, prm);

            if (selectedColor != null)
            {
                selectedText = selectedColor.Name;
            }
            selectedCD     = selectedColor;
            clrTable.Usage = flags;
            unselectedText = StringTable.GetString("ColorDef.Undefined");
            toWatch        = go as IGeoObject; // may be null
        }
コード例 #3
0
        public void Init(System.Drawing.Point SourcePoint, Projection projection, SnapModes SnapMode, int MaxDist)
#endif
        {
            this.BestDist       = double.MaxValue;
            this.BestObject     = null;
            this.SnapPointIndex = 0;
            SourceBeam          = projection.PointBeam(SourcePoint);
            this.SourcePoint    = projection.ProjectionPlane.Intersect(SourceBeam);
            this.Projection     = projection;
            this.SnapPoint      = projection.DrawingPlanePoint(SourcePoint);
            // MaxDist die die maximale Entfernung des Fangpunktes vom aktuellen Punkt bezogen auf die ProjectionPlane
#if WEBASSEMBLY
            GeoPoint2D p1 = projection.ProjectionPlane.Intersect(projection.PointBeam(new CADability.WebDrawing.Point(SourcePoint.X, SourcePoint.Y + MaxDist)));
            GeoPoint2D p2 = projection.ProjectionPlane.Intersect(projection.PointBeam(new CADability.WebDrawing.Point(SourcePoint.X + MaxDist, SourcePoint.Y)));
            GeoPoint2D p3 = projection.ProjectionPlane.Intersect(projection.PointBeam(new CADability.WebDrawing.Point(SourcePoint.X, SourcePoint.Y - MaxDist)));
            GeoPoint2D p4 = projection.ProjectionPlane.Intersect(projection.PointBeam(new CADability.WebDrawing.Point(SourcePoint.X - MaxDist, SourcePoint.Y)));
#else
            GeoPoint2D p1 = projection.ProjectionPlane.Intersect(projection.PointBeam(new System.Drawing.Point(SourcePoint.X, SourcePoint.Y + MaxDist)));
            GeoPoint2D p2 = projection.ProjectionPlane.Intersect(projection.PointBeam(new System.Drawing.Point(SourcePoint.X + MaxDist, SourcePoint.Y)));
            GeoPoint2D p3 = projection.ProjectionPlane.Intersect(projection.PointBeam(new System.Drawing.Point(SourcePoint.X, SourcePoint.Y - MaxDist)));
            GeoPoint2D p4 = projection.ProjectionPlane.Intersect(projection.PointBeam(new System.Drawing.Point(SourcePoint.X - MaxDist, SourcePoint.Y)));
#endif
            this.MaxDist        = Math.Max(Math.Max(p1 | this.SourcePoint, p2 | this.SourcePoint), Math.Max(p3 | this.SourcePoint, p4 | this.SourcePoint));
            pickArea            = projection.GetPickSpace(new Rectangle(SourcePoint.X - MaxDist, SourcePoint.Y - MaxDist, 2 * MaxDist, 2 * MaxDist));
            this.BasePointValid = false;
            this.SnapMode       = SnapMode;
            this.DidSnap        = DidSnapModes.DidNotSnap;
            faceDist            = double.MaxValue;
        }
コード例 #4
0
        /// <summary>
        /// Use all active filters in this list to check whether an object is accepted or not.
        /// If there is a <see cref="PreFilterEvent"/> the this event will be called.
        /// </summary>
        /// <param name="go">Object to check</param>
        /// <returns>true: accepted, false: rejected</returns>
        public bool Accept(IGeoObject go)
        {
            bool accepted            = true;
            bool doInternalFiltering = true;

            if (PreFilterEvent != null)
            {
                PreFilterEvent(this, go, out accepted, out doInternalFiltering);
            }
            if (!accepted)
            {
                return(false);
            }
            if (!doInternalFiltering)
            {
                return(accepted);
            }
            foreach (DictionaryEntry de in entries)
            {
                Filter f = de.Value as Filter;
                if (f.IsActive)
                {
                    if (!f.Accept(go))
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
コード例 #5
0
ファイル: MoveObjects.cs プロジェクト: SOFAgh/CADability
 public override void OnDone()
 {
     // ist die Shift Taste gehalten, so werden Kopien gemacht, d.h. der die Elemente
     // des blocks werden eingefügt. Ansonsten werden die original-Objekte verändert
     // TODO: Feedback über Cursor bei Shift-Taste fehlt noch
     // TODO: die neuen oder veränderten Objekte sollten markiert sein.
     using (Frame.Project.Undo.UndoFrame)
     {
         ModOp m = ModOp.Translate(offset);
         if (((Frame.UIService.ModifierKeys & Keys.Shift) != 0) || copyObject)
         {
             GeoObjectList cloned = new GeoObjectList();
             foreach (IGeoObject go in originals)
             {
                 IGeoObject cl = go.Clone();
                 cl.Modify(m);
                 //					go.Owner.Add(cl);
                 cloned.Add(cl);
             }
             base.Frame.Project.GetActiveModel().Add(cloned);
         }
         else
         {
             originals.Modify(m);
         }
     }
     base.ActiveObject = null; // damit es nicht gleich eingefügt wird
     base.OnDone();
 }
コード例 #6
0
ファイル: Line.cs プロジェクト: SOFAgh/CADability
        ICurve ICurve.CloneModified(ModOp m)
        {
            IGeoObject clone = Clone();

            clone.Modify(m);
            return((ICurve)clone);
        }
コード例 #7
0
        public override void OnDone()
        {
            if (base.ActiveObject != null)
            {
                using (base.Frame.Project.Undo.UndoFrame)
                {
                    if (iCurveOrg != null) // evtl. Einzelobjekt (Polyline oder Path) als Original rauslöschen
                    {
                        owner.Remove(iCurveOrg as IGeoObject);
                    }

                    ICurve[] iCurveList = new ICurve[blk.Count]; // der Pfad braucht eine Kurvenliste
                    for (int i = 0; i < blk.Count; ++i)
                    {
                        iCurveList[i] = blk.Item(i) as ICurve; // von Block zu Liste
                    }
                    blk.Clear();                               // weg mit dem Block, damit die Objekte nur einen owner haben
                    base.ActiveObject = null;                  // damit der onDone-Mechanismus nichts einfügt

                    if (Frame.GetBooleanSetting("Construct.MakePath", true))
                    {                         // das Ergebnis soll in einem Pfad zusammengefasst werden!
                        Path path = Path.Construct();
                        path.Set(iCurveList); // macht den Path mit Header und so
                        path.CopyAttributes(iCurveSel as IGeoObject);
                        owner.Add(path);      // nur zum owner des angeklickten Ursprungsobjekts
                    }
                    else
                    {
                        for (int i = 0; i < iCurveList.Length; ++i)
                        {
                            owner.Add(iCurveList[i] as IGeoObject); // nur zum owner des angeklickten Ursprungsobjekts
                        }
                    }

                    if (iCurveOrg == null)  // die Einzelelemente des CreateFromModel identifizieren
                    //for (int i=0; i < iCurveList.Length; ++i)
                    //{
                    //    IGeoObject obj = (iCurveList[i] as IGeoObject).UserData.GetData("CADability.Path.Original") as IGeoObject;
                    //    if (obj!=null && obj.Owner!=null) obj.Owner.Remove(obj); // löschen
                    //}
                    {
                        for (int i = 0; i < pathCreatedFromModel.Count; ++i) // über den ursprünglichen Pfad laufen
                        {
                            IGeoObject obj = null;
                            if ((pathCreatedFromModel.Curve(i) as IGeoObject).UserData.ContainsData("CADability.Path.Original"))
                            {
                                obj = (pathCreatedFromModel.Curve(i) as IGeoObject).UserData.GetData("CADability.Path.Original") as IGeoObject;
                            }
                            if (obj != null && obj.Owner != null)
                            {
                                obj.Owner.Remove(obj);                                   // löschen
                            }
                            (pathCreatedFromModel.Curve(i) as IGeoObject).UserData.RemoveUserData("CADability.Path.Original");
                        }
                    }
                }
                base.ActiveObject = null;
            }
            base.OnDone();
        }
コード例 #8
0
 private void PaintFlatVisibleLayer(IPaintTo3D iPaintTo3D, IGeoObject go, Hashtable visibleLayers)
 {
     // beim Drucken dürfen keine Displaylisten verwendet werden, denn es geht auf ein Bitmap
     // deshalb hier rekursiv runterbrechen, bis die Ebene klar ist und dann ohne Liste
     // auf iPaintTo3D ausgeben.
     if (go is Block)
     {
         Block blk = go as Block;
         for (int i = 0; i < blk.Count; ++i)
         {
             PaintFlatVisibleLayer(iPaintTo3D, blk.Child(i), visibleLayers);
         }
     }
     else if (go is BlockRef)
     {
         PaintFlatVisibleLayer(iPaintTo3D, (go as BlockRef).Flattened, visibleLayers);
     }
     else
     {
         if (go.Layer == null || visibleLayers.ContainsKey(go.Layer))
         {
             go.PaintTo3D(iPaintTo3D); // iPaintTo3D enthält die Information, dass keine Listen verwendet werden dürfen
         }
     }
 }
コード例 #9
0
 static public IGeoObject AssertColor(IGeoObject go)
 {
     if (go is IColorDef cd && cd.ColorDef == null)
     {
         if (go is GeoObject.Point)
         {
             cd.ColorDef = PointColor;
         }
         if (go is ICurve)
         {
             cd.ColorDef = CurveColor;
         }
         if (go is Face)
         {
             cd.ColorDef = FaceColor;
         }
         if (go is Shell)
         {
             cd.ColorDef = FaceColor;
         }
         if (go is Solid)
         {
             cd.ColorDef = FaceColor;
         }
     }
     return(go);
 }
コード例 #10
0
 private bool ruledFaceOrg()
 {
     if (!(Precision.IsEqual(p1.StartPoint, p2.StartPoint) && (Precision.IsEqual(p1.EndPoint, p2.EndPoint)))) // 1. Näherung, dass sie nicht gleich sind!
     {
         if ((p1.IsClosed && p2.IsClosed) || (!p1.IsClosed && !p2.IsClosed))                                  // OPenCascade will nur geschlossene oder nur offene
         {
             if ((((p1 as ICurve).GetPlanarState() == PlanarState.Planar) || (p1 as ICurve).GetPlanarState() == PlanarState.UnderDetermined) && (((p2 as ICurve).GetPlanarState() == PlanarState.Planar) || (p2 as ICurve).GetPlanarState() == PlanarState.UnderDetermined))
             { // also nur Ebene Pfade mit unterschiedlichen Ebenen oder unbestimmt, z.B. Linien:
                 if (((p1 as ICurve).GetPlanarState() == PlanarState.Planar) && ((p2 as ICurve).GetPlanarState() == PlanarState.Planar) && Precision.IsEqual((p1 as ICurve).GetPlane(), (p2 as ICurve).GetPlane()))
                 {
                     return(false);
                 }
                 // also was geeignetes dabei
                 IGeoObject ss = Make3D.MakeRuledShell(p1, p2, Frame.Project);
                 if (ss != null)
                 {
                     if (base.ActiveObject != null)
                     {
                         ss.CopyAttributes(base.ActiveObject);
                     }
                     // der block wird das neue aktive Objekt, er muss die Attribute tragen, weil sie später
                     // wieder von ihm verlangt werden
                     //                        ss.CopyAttributes(attrObject);
                     base.ActiveObject     = ss; // darstellen
                     base.ShowActiveObject = true;
                     return(true);
                 }
             }
         }
     }
     base.ShowActiveObject = false;
     return(false);
 }
コード例 #11
0
 static public void SpaceDown(GeoObjectList gl, Projection projection, Project pr)
 {
     using (pr.Undo.UndoFrame)
     {
         IGeoObject[] geoArray = new IGeoObject[gl.Count];
         for (int i = 0; i < gl.Count; ++i) // umkopieren auf ein Array, um den Sort machen zu können
         {
             geoArray[i] = gl[i];
         }
         // hier nun Sort, der Compare steht oben als lokal class und braucht die Parameter: Sort nach y = false und pm
         Array.Sort(geoArray, 0, geoArray.Length, new CompareGeoObject(false, projection));
         // die Rechtecke des ersten und letzten Objeks für die Gesamtausdehnung
         BoundingRect reStart = IGeoObjectImpl.GetExtent(geoArray[0], projection, false);
         BoundingRect reEnd   = IGeoObjectImpl.GetExtent(geoArray[geoArray.Length - 1], projection, false);
         double       reTotal = reEnd.Top - reStart.Bottom; // Gesamtausdehnung
         double       distRe  = 0;
         for (int i = 0; i < geoArray.Length; ++i)          // Summe der Ausdehnung der Einzelnen:
         {
             BoundingRect re = IGeoObjectImpl.GetExtent(geoArray[i], projection, false);
             distRe = distRe + re.Height;
         }
         double space = (reTotal - distRe) / (geoArray.Length - 1); // Gesamt - Summe Einzelne / Zwischenräume
         double pos   = reStart.Top;
         for (int i = 1; i < geoArray.Length - 1; ++i)              // vom zweiten bis zum vorletzten, die Äußeren bleiben unverändert
         {
             BoundingRect re      = IGeoObjectImpl.GetExtent(geoArray[i], projection, false);
             GeoVector2D  trans2D = new GeoVector2D(0, pos + space - re.Bottom);
             pos = pos + space + re.Height; // pos hochzählen auf den oberen Rand des aktuellen
             GeoVector trans = projection.DrawingPlane.ToGlobal(trans2D);
             ModOp     m     = ModOp.Translate(trans);
             geoArray[i].Modify(m);
         }
     }
 }
コード例 #12
0
ファイル: Constr3DChamfer.cs プロジェクト: SOFAgh/CADability
        bool OnMouseOverFace(ConstructAction.GeoObjectInput sender, IGeoObject[] TheGeoObjects, bool up)
        {
            bool ok = false;

            for (int i = 0; i < TheGeoObjects.Length; ++i)
            {
                if (TheGeoObjects[i] is Face)
                {
                    ok = true;
                    if (up)
                    {
                        theFace = (TheGeoObjects[i] as Face);
                        foreach (Edge edge in edges)
                        {
                            base.FeedBack.RemoveSelected(edge.Curve3D as IGeoObject);
                        }
                        edges.Clear();
                        edges.AddRange(theFace.AllEdges);
                        List <IGeoObject> geoObjects = new List <IGeoObject>();
                        foreach (Edge edge in edges)
                        {
                            IGeoObject go = edge.Curve3D as IGeoObject;
                            if (go != null)
                            {
                                base.FeedBack.AddSelected(go);
                                geoObjects.Add(go);
                            }
                        }
                        edgesInput.SetGeoObject(geoObjects.ToArray(), null);
                        firstClickClearsAll = true;
                    }
                }
            }
            return(ok);
        }
コード例 #13
0
        public Constr3DRuledFace(GeoObjectList geoObjectList, IFrame frame)
        { // constructor für SelectedObjectsAction, ein selektierter Pfad
            bool pathCreatedFromModel;

            if (geoObjectList == null)
            {
                selectedMode = 0;
            }
            else
            {
                //if (geoObjectList.Count == 2)
                //    {  ruledSolidDo(geoObjectList, frame); }
                //else
                selectedMode = 1;
                p1           = findPath(geoObjectList[0], frame.ActiveView.Model, out pathCreatedFromModel);
                if (p1 != null)
                {
                    attrObject     = geoObjectList[0];       // merker, um das passende Attribut zu bekommen
                    iGeoObjectOrg1 = geoObjectList[0];       // zum Weglöschen des Originals in onDone
                    owner1         = geoObjectList[0].Owner; // owner merken für löschen
                    if (pathCreatedFromModel)
                    {
                        iGeoObjectOrg1        = null; // zum nicht Weglöschen des Originals in onDone
                        pathCreatedFromModel1 = p1;   // kopie merken für onDone
                    }
                }
            }
        }
コード例 #14
0
        /// <summary>
        /// Overrides <see cref="CADability.GeoObject.ISurfaceImpl.Make3dCurve (ICurve2D)"/>
        /// </summary>
        /// <param name="curve2d"></param>
        /// <returns></returns>
        public override ICurve Make3dCurve(CADability.Curve2D.ICurve2D curve2d)
        {
            if (curve2d is Curve2DAspect)
            {
                ICurve res = (curve2d as Curve2DAspect).Get3DCurve(this);
                if (res != null)
                {
                    return(res);
                }
            }
            if (curve2d is ProjectedCurve pc)
            {
                if (pc.Surface is PlaneSurface)
                {
                    BoundingRect otherBounds = new BoundingRect(PositionOf(pc.Surface.PointAt(pc.StartPoint)), PositionOf(pc.Surface.PointAt(pc.EndPoint)));
                    if (pc.Surface.SameGeometry(pc.GetExtent(), this, otherBounds, Precision.eps, out ModOp2D notneeded))
                    {
                        return(pc.Curve3DFromParams); // if trimmed or reversed still returns the correct 3d curve (but trimmed and/or reversed)
                    }
                }
            }
            IGeoObject go = curve2d.MakeGeoObject(Plane.XYPlane);

            go.Modify(fromUnitPlane);
            return(go as ICurve);
        }
コード例 #15
0
 private void OnDidChange(IGeoObject Sender, GeoObjectChange Change)
 {
     if (isChanging == 0)
     {
         FireDidChange(Change);
     }
 }
コード例 #16
0
 /// <summary>
 /// Will be called when the state of an entry in the ControlCenter changes. this implementation must be called by a class overriding this method.
 /// </summary>
 /// <param name="sender">The ShowProperty that changed its state</param>
 /// <param name="args">The new state</param>
 protected void OnShowPropertyStateChanged(IPropertyEntry sender, StateChangedArgs args)
 {
     if (sender is IGeoObjectShowProperty)
     {
         if (args.EventState == StateChangedArgs.State.Selected)
         {
             focusedSelectedObject = (sender as IGeoObjectShowProperty).GetGeoObject();
             if (FocusedObjectChangedEvent != null)
             {
                 FocusedObjectChangedEvent(this, focusedSelectedObject);
             }
         }
         else if (args.EventState == StateChangedArgs.State.UnSelected)
         {
             if (focusedSelectedObject == (sender as IGeoObjectShowProperty).GetGeoObject())
             {
                 focusedSelectedObject = null;
             }
             if (FocusedObjectChangedEvent != null)
             {
                 FocusedObjectChangedEvent(this, focusedSelectedObject);
             }
         }
         else
         {
             return;
         }
         foreach (IView vw in base.Frame.AllViews)
         {
             vw.Invalidate(PaintBuffer.DrawingAspect.Select, vw.DisplayRectangle);
         }
     }
 }
コード例 #17
0
        private bool Recalc()
        {
            if (theBaseCurve == null)
            {
                return(false);
            }
            Plane pln;

            if (theBaseCurve.GetPlanarState() == PlanarState.Planar)
            {
                pln = theBaseCurve.GetPlane();
            }
            else
            {
                pln = base.ActiveDrawingPlane;
            }
            ICurve2D c2d = theBaseCurve.GetProjectedCurve(pln);
            ICurve2D app = c2d.Approximate(false, Frame.GetDoubleSetting("Approximate.Precision", 0.01));
            Border   bdr = new Border(app);

            Border[] res = bdr.GetParallel(theDistance, true, 0.0, theMinAngle);
            Block    blk = Block.Construct();

            for (int i = 0; i < res.Length; ++i)
            {
                IGeoObject go = res[i].AsPath().MakeGeoObject(pln);
                go.CopyAttributes(theBaseCurve as IGeoObject);
                (go as IColorDef).ColorDef = (theBaseCurve as IColorDef).ColorDef;
                blk.Add(go);
            }
            base.ActiveObject = blk;
            return(true);
        }
コード例 #18
0
            public int Compare(object x, object y)
            {   // Typ-Casting
                IGeoObject o1 = (IGeoObject)x;
                IGeoObject o2 = (IGeoObject)y;
                // Sortierung nach Mittelpunkten
                BoundingRect re = IGeoObjectImpl.GetExtent(o1, projection, false);
                GeoPoint2D   p1 = re.GetCenter();

                re = IGeoObjectImpl.GetExtent(o2, projection, false);
                GeoPoint2D p2 = re.GetCenter();

                if (dirx)
                {
                    if (p1.x < p2.x)
                    {
                        return(-1);
                    }
                    if (p1.x > p2.x)
                    {
                        return(1);
                    }
                }
                else
                {
                    if (p1.y < p2.y)
                    {
                        return(-1);
                    }
                    if (p1.y > p2.y)
                    {
                        return(1);
                    }
                }
                return(0);
            }
コード例 #19
0
 private void OnGeoObjectDidChange(IGeoObject Sender, GeoObjectChange Change)
 {
     centerProperty.GeoPointChanged();
     majorRadiusProperty.LengthChanged();
     majorRadiusHotSpot[0].Position = ellipse.Center + 2.0 / 3.0 * ellipse.MajorAxis;
     majorRadiusHotSpot[1].Position = ellipse.Center - 2.0 / 3.0 * ellipse.MajorAxis;
     minorRadiusProperty.LengthChanged();
     minorRadiusHotSpot[0].Position = ellipse.Center + 2.0 / 3.0 * ellipse.MinorAxis;
     minorRadiusHotSpot[1].Position = ellipse.Center - 2.0 / 3.0 * ellipse.MinorAxis;
     majorAxisProperty.GeoVectorChanged();
     majorAxisHotSpot[0].Position = ellipse.Center + ellipse.MajorAxis;
     majorAxisHotSpot[1].Position = ellipse.Center - ellipse.MajorAxis;
     minorAxisProperty.GeoVectorChanged();
     minorAxisHotSpot[0].Position = ellipse.Center + ellipse.MinorAxis;
     minorAxisHotSpot[1].Position = ellipse.Center - ellipse.MinorAxis;
     if (startAngleProperty != null)
     {
         startAngleProperty.AngleChanged();
         startAngleHotSpot.Position = ellipse.StartPoint;
         startPointProperty.Refresh();
         if (endAngleProperty != null)
         {
             endAngleProperty.AngleChanged();
             endAngleHotSpot.Position = ellipse.EndPoint;
             endPointProperty.Refresh();
         }
     }
     if (directionProperty != null)
     {
         directionProperty.Refresh();
     }
 }
コード例 #20
0
ファイル: ActionFeedBack.cs プロジェクト: SOFAgh/CADability
 /// <summary>
 /// Adds a GeoObject to the list of displayed objects. In contrary to <see cref="Add"/> the object is displayed
 /// in the select color and the select display mode.
 /// </summary>
 /// <param name="feedBackObject">Object to add</param>
 /// <returns>the index in the list, may be used for <see cref="RemoveSelected(int)"/></returns>
 public int AddSelected(IGeoObject feedBackObject)
 {
     paintAsSelected.Add(feedBackObject);
     (feedBackObject as IFeedBack).FeedBackChangedEvent += new FeedBackChangedDelegate(OnFeedBackChanged);
     OnFeedBackChanged(feedBackObject as IFeedBack);
     return(paintAsSelected.Count - 1);
 }
コード例 #21
0
 public virtual void Insert(int index, IGeoObject ToAdd)
 {
     using (new Changing(this, "Remove", ToAdd))
     {
         if (ToAdd.Owner != null)
         {
             ToAdd.Owner.Remove(ToAdd);
         }
         lock (this)
         {
             containedObjects.Insert(index, ToAdd);
         }
         ToAdd.WillChangeEvent += new ChangeDelegate(OnWillChange);
         ToAdd.DidChangeEvent  += new ChangeDelegate(OnDidChange);
         ToAdd.Owner            = this;
         IColorDef cd = ToAdd as IColorDef;
         if (cd != null && cd.ColorDef != null)
         {
             if (cd.ColorDef.Source == ColorDef.ColorSource.fromParent)
             {
                 cd.ColorDef = CDfromParent;
             }
         }
     }
 }
コード例 #22
0
 private void AssertColor(IGeoObject go)
 {
     if (go is IColorDef cd && cd.ColorDef == null)
     {
         if (go is GeoObject.Point)
         {
             cd.ColorDef = PointColor;
         }
         if (go is ICurve)
         {
             cd.ColorDef = CurveColor;
         }
         if (go is Face)
         {
             cd.ColorDef = FaceColor;
         }
         if (go is Shell)
         {
             cd.ColorDef = FaceColor;
         }
         if (go is Solid)
         {
             cd.ColorDef = FaceColor;
         }
     }
 }
コード例 #23
0
        private EntityObject GeoObjectToEntity(IGeoObject geoObject)
        {
            EntityObject entity = null;

            switch (geoObject)
            {
            case GeoObject.Point point: entity = ExportPoint(point); break;

            case GeoObject.Line line: entity = ExportLine(line); break;

            case GeoObject.Ellipse elli: entity = ExportEllipse(elli); break;

            case GeoObject.Polyline polyline: entity = ExportPolyline(polyline); break;

            case GeoObject.BSpline bspline: entity = ExportBSpline(bspline); break;

            case GeoObject.Path path: entity = ExportPath(path); break;

            case GeoObject.Text text: entity = ExportText(text); break;

            case GeoObject.Block block: entity = ExportBlock(block); break;
            }
            if (entity != null)
            {
                SetAttributes(entity, geoObject);
                SetUserData(entity, geoObject);
            }

            return(entity);
        }
コード例 #24
0
        public void Add(ICurve2D c2d)
        {
            IGeoObject go = c2d.MakeGeoObject(Plane.XYPlane);

            AssertColor(go);
            toShow.Add(go);
        }
コード例 #25
0
 public override void OnDone()
 {
     if (base.ActiveObject != null)
     {
         using (base.Frame.Project.Undo.UndoFrame)
         {
             Frame.ActiveView.Canvas.Cursor = "WaitCursor";
             GeoObjectList ToAdd = new GeoObjectList();
             Model         m     = base.Frame.ActiveView.Model;
             PlaneSurface  pls   = new PlaneSurface(plane);
             for (int i = 0; i < m.Count; ++i) // durch das ganze Modell laufen
             {
                 ICurve[] crvs = Intersect(m[i], pls);
                 if (crvs != null)
                 {
                     for (int k = 0; k < crvs.Length; k++)
                     {
                         IGeoObject go = crvs[k] as IGeoObject;
                         go.CopyAttributes(base.ActiveObject);
                         ToAdd.Add(go);
                     }
                 }
             }
             m.Add(ToAdd);
             base.KeepAsLastStyle(ActiveObject);
             base.ActiveObject = null;
             base.OnDone();
         }
     }
 }
コード例 #26
0
ファイル: Constr3DMakeFace.cs プロジェクト: SOFAgh/CADability
 void geoObjectInputFaceChanged(ConstructAction.GeoObjectInput sender, IGeoObject SelectedGeoObject)
 {
     selectedObjectsList.Clear();
     base.FeedBack.ClearSelected();
     selectedObjectsList.Add(SelectedGeoObject); // das eine in die Liste
     ListDefault(1);                             // die Listen löschen und mit "1" vorbesetzen
     makeFaceOrg();
 }
コード例 #27
0
 public void Add(IGeoObject toAdd)
 {
     AssertColor(toAdd);
     if (toAdd != null)
     {
         toShow.Add(toAdd);
     }
 }
コード例 #28
0
        /// <summary>
        /// While the normal <see cref="HitTest(Projection.PickArea, bool)">HitTest</see> only checkes the <see cref="Location"/> of the object
        /// this method checks the hittest of the object expanded according to the projection in this <paramref name="area"/>
        /// </summary>
        /// <param name="area">Pick area to check</param>
        /// <param name="onlyInside">true, if the whole object must reside inside the pickarea, false if overlapping will suffice</param>
        /// <returns>true when a hit is recognized</returns>
        public bool RealHitTest(Projection.PickArea area, bool onlyInside)
        {
            ModOp      m     = ModOp.Translate(location.x, location.y, location.z) * ModOp.Scale(area.Projection.DeviceToWorldFactor);
            IGeoObject clone = geoObject.Clone();

            clone.Modify(m);
            return(clone.HitTest(area, onlyInside));
        }
コード例 #29
0
 public GeneralGeoPointAction(GeoPointProperty GeoPointProperty, IGeoObject ignoreSnap)
     : this(GeoPointProperty)
 {
     if (ignoreSnap != null)
     {
         base.IgnoreForSnap = new GeoObjectList(ignoreSnap);
     }
 }
コード例 #30
0
 public GeneralGeoPointAction(GeoPoint initialGeoPointValue, IGeoObject ignoreSnap)
     : this(initialGeoPointValue)
 {
     if (ignoreSnap != null)
     {
         base.IgnoreForSnap = new GeoObjectList(ignoreSnap);
     }
 }