Beispiel #1
0
        /// <summary>
        /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.PaintTo3D (IPaintTo3D)"/>
        /// </summary>
        /// <param name="paintTo3D"></param>
        public override void PaintTo3D(IPaintTo3D paintTo3D)
        {
            ModOp m = ModOp.Translate(location.x, location.y, location.z) * ModOp.Scale(paintTo3D.PixelToWorld);

            paintTo3D.PushMultModOp(m);
            geoObject.PaintTo3D(paintTo3D);
            paintTo3D.PopModOp();
        }
Beispiel #2
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));
        }
Beispiel #3
0
        private bool SetFactor3(double val)
        {       // zunächst: Block zurücksetzen
            for (int i = 0; i < originals.Count; ++i)
            {
                block.Item(i).CopyGeometry(originals[i]);
            }
            ModOp m;

            m = ModOp.Scale(base.BasePoint, base.ActiveDrawingPlane.DirectionX, faktorX) * ModOp.Scale(base.BasePoint, base.ActiveDrawingPlane.DirectionY, faktorY) * ModOp.Scale(base.BasePoint, base.ActiveDrawingPlane.Normal, val);
            if (Precision.IsNull(Math.Abs(m.Determinant)))
            {
                return(false);
            }
            block.Modify(m);
            faktorZ = val;
            return(true);
        }
Beispiel #4
0
 static public void SameHeight(GeoObjectList gl, Projection projection, Project pr)
 {
     using (pr.Undo.UndoFrame)
     {
         BoundingRect re1 = IGeoObjectImpl.GetExtent(gl[gl.Count - 1], projection, false);
         for (int i = 0; i < gl.Count - 1; ++i)
         {
             BoundingRect re  = IGeoObjectImpl.GetExtent(gl[i], projection, false);
             double       hig = 1;
             if (re.Height != 0)
             {
                 hig = re1.Height / re.Height;
             }
             GeoPoint refPkt = projection.DrawingPlane.ToGlobal(re.GetCenter());
             ModOp    m      = ModOp.Scale(refPkt, new GeoVector(0.0, 1.0, 0.0), hig);
             gl[i].Modify(m);
         }
     }
 }
Beispiel #5
0
        private bool SetFactor(double val)
        {       // zunächst: Block zurücksetzen
            for (int i = 0; i < originals.Count; ++i)
            {
                block.Item(i).CopyGeometry(originals[i]);
            }
            ModOp m;

            m = ModOp.Scale(base.BasePoint, val);
            if (Precision.IsNull(Math.Abs(m.Determinant)))
            {
                return(false);
            }
            faktorX = val;
            faktorY = val;
            faktorZ = val;
            block.Modify(m);
            faktor = val;
            return(true);
        }
Beispiel #6
0
 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;
         if (!dis)
         {
             m = ModOp.Scale(base.BasePoint, faktor);       // ein faktor für alle!
         }
         else
         {       // 3 Faktoren für 3 Achsen
             m = ModOp.Scale(base.BasePoint, base.ActiveDrawingPlane.DirectionX, faktorX) * ModOp.Scale(base.BasePoint, base.ActiveDrawingPlane.DirectionY, faktorY) * ModOp.Scale(base.BasePoint, base.ActiveDrawingPlane.Normal, faktorZ);
         }
         if (!Precision.IsNull(Math.Abs(m.Determinant)))
         {
             if (((Frame.UIService.ModifierKeys & Keys.Shift) != 0) || copyObject)
             {
                 GeoObjectList cloned = new GeoObjectList();
                 foreach (IGeoObject go in originals)
                 {
                     IGeoObject cl = go.Clone();
                     cl.Modify(m);
                     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();
 }