Beispiel #1
0
        public void RestoreTo(CadFigure fig)
        {
            fig.ID     = ID;
            fig.Locked = Locked;
            fig.IsLoop = IsLoop;
            fig.Normal = Normal.Restore();

            if (ChildList != null)
            {
                fig.ChildList = MpUtil_v1002.FigureListFromMp_v1002(ChildList);

                for (int i = 0; i < fig.ChildList.Count; i++)
                {
                    CadFigure c = fig.ChildList[i];
                    c.Parent = fig;
                }
            }
            else
            {
                fig.ChildList.Clear();
            }

            fig.GeometricDataFromMp_v1002(GeoData);

            fig.Name = Name;
        }
Beispiel #2
0
        public static MpLayer_v1002 Create(CadLayer layer)
        {
            MpLayer_v1002 ret = new MpLayer_v1002();

            ret.ID      = layer.ID;
            ret.Visible = layer.Visible;
            ret.Locked  = layer.Locked;

            ret.FigureIdList = MpUtil_v1002.FigureListToIdList(layer.FigureList);

            return(ret);
        }
Beispiel #3
0
        public NurbsLine Restore()
        {
            NurbsLine nurbs = new NurbsLine();

            nurbs.CtrlCnt     = CtrlCnt;
            nurbs.CtrlDataCnt = CtrlDataCnt;
            nurbs.Weights     = MpUtil_v1002.ArrayClone <double>(Weights);
            nurbs.CtrlPoints  = MpUtil_v1002.VertexListFromMp(CtrlPoints);
            nurbs.CtrlOrder   = MpUtil_v1002.ArrayClone <int>(CtrlOrder);

            nurbs.BSplineP = BSplineP.Restore();

            return(nurbs);
        }
Beispiel #4
0
        public static MpNurbsLine_v1002 Create(NurbsLine src)
        {
            MpNurbsLine_v1002 ret = new MpNurbsLine_v1002();

            ret.CtrlCnt     = src.CtrlCnt;
            ret.CtrlDataCnt = src.CtrlDataCnt;
            ret.Weights     = MpUtil_v1002.ArrayClone <double>(src.Weights);
            ret.CtrlPoints  = MpUtil_v1002.VertexListToMp(src.CtrlPoints);
            ret.CtrlOrder   = MpUtil_v1002.ArrayClone <int>(src.CtrlOrder);

            ret.BSplineP = MpBSplineParam_v1002.Create(src.BSplineP);

            return(ret);
        }
Beispiel #5
0
        public BSplineParam Restore()
        {
            BSplineParam bs = new BSplineParam();

            bs.Degree    = Degree;
            bs.DivCnt    = DivCnt;
            bs.OutputCnt = OutputCnt;
            bs.KnotCnt   = KnotCnt;
            bs.Knots     = MpUtil_v1002.ArrayClone <double>(Knots);
            bs.LowKnot   = LowKnot;
            bs.HighKnot  = HighKnot;
            bs.Step      = Step;

            return(bs);
        }
Beispiel #6
0
        public static MpBSplineParam_v1002 Create(BSplineParam src)
        {
            MpBSplineParam_v1002 ret = new MpBSplineParam_v1002();

            ret.Degree    = src.Degree;
            ret.DivCnt    = src.DivCnt;
            ret.OutputCnt = src.OutputCnt;
            ret.KnotCnt   = src.KnotCnt;
            ret.Knots     = MpUtil_v1002.ArrayClone <double>(src.Knots);
            ret.LowKnot   = src.LowKnot;
            ret.HighKnot  = src.HighKnot;
            ret.Step      = src.Step;

            return(ret);
        }
Beispiel #7
0
        public static MpCadObjectDB_v1002 Create(CadObjectDB db)
        {
            MpCadObjectDB_v1002 ret = new MpCadObjectDB_v1002();

            ret.LayerIdCount  = db.LayerIdProvider.Counter;
            ret.FigureIdCount = db.FigIdProvider.Counter;

            ret.FigureList = MpUtil_v1002.FigureMapToMp_v1002(db.FigureMap);

            ret.LayerList = MpUtil_v1002.LayerListToMp(db.LayerList);

            ret.CurrentLayerID = db.CurrentLayerID;

            return(ret);
        }
Beispiel #8
0
        public CadObjectDB Restore()
        {
            CadObjectDB ret = new CadObjectDB();

            ret.LayerIdProvider.Counter = LayerIdCount;
            ret.FigIdProvider.Counter   = FigureIdCount;

            // Figure map
            List <CadFigure> figList = MpUtil_v1002.FigureListFromMp_v1002(FigureList);

            var dic = new Dictionary <uint, CadFigure>();

            for (int i = 0; i < figList.Count; i++)
            {
                CadFigure fig = figList[i];

                dic.Add(fig.ID, fig);
                FigureList[i].TempFigure = fig;
            }

            ret.FigureMap = dic;


            // Child list
            for (int i = 0; i < figList.Count; i++)
            {
                MpFigure_v1002 mpfig = FigureList[i];
                SetFigChild(mpfig, dic);
            }


            // Layer map
            ret.LayerList = MpUtil_v1002.LayerListFromMp(LayerList, dic);

            ret.LayerMap = new Dictionary <uint, CadLayer>();

            for (int i = 0; i < ret.LayerList.Count; i++)
            {
                CadLayer layer = ret.LayerList[i];

                ret.LayerMap.Add(layer.ID, layer);
            }

            ret.CurrentLayerID = CurrentLayerID;

            return(ret);
        }
Beispiel #9
0
        public NurbsSurface Restore()
        {
            NurbsSurface nurbs = new NurbsSurface();

            nurbs.UCtrlCnt = UCtrlCnt;
            nurbs.VCtrlCnt = VCtrlCnt;

            nurbs.UCtrlDataCnt = UCtrlDataCnt;
            nurbs.VCtrlDataCnt = VCtrlDataCnt;

            nurbs.CtrlPoints = MpUtil_v1002.VertexListFromMp(CtrlPoints);

            nurbs.Weights   = MpUtil_v1002.ArrayClone <double>(Weights);
            nurbs.CtrlOrder = MpUtil_v1002.ArrayClone <int>(CtrlOrder);

            nurbs.UBSpline = UBSpline.Restore();
            nurbs.VBSpline = VBSpline.Restore();

            return(nurbs);
        }
Beispiel #10
0
        public static MpHeModel_v1002 Create(HeModel model)
        {
            MpHeModel_v1002 ret = new MpHeModel_v1002();

            ret.VertexStore = MpUtil_v1002.VertexListToMp(model.VertexStore);

            ret.NormalStore = MpUtil_v1002.Vector3dListToMp(model.NormalStore);

            ret.FaceStore = MpUtil_v1002.HeFaceListToMp(model.FaceStore);

            ret.HeIdCount = model.HeIdProvider.Counter;

            ret.FaceIdCount = model.FaceIdProvider.Counter;

            List <HalfEdge> heList = model.GetHalfEdgeList();

            ret.HalfEdgeList = MpUtil_v1002.HalfEdgeListToMp(heList);

            return(ret);
        }
Beispiel #11
0
        public HeModel Restore()
        {
            HeModel ret = new HeModel();

            ret.VertexStore = MpUtil_v1002.VertexListFromMp(VertexStore);

            ret.NormalStore = MpUtil_v1002.Vector3dListFromMp(NormalStore);

            // Create dictionary
            Dictionary <uint, HalfEdge> dic = new Dictionary <uint, HalfEdge>();

            dic[0] = null;

            for (int i = 0; i < HalfEdgeList.Count; i++)
            {
                HalfEdge he = HalfEdgeList[i].Restore();
                dic.Add(he.ID, he);

                HalfEdgeList[i].TempHalfEdge = he;
            }

            // Create links
            for (int i = 0; i < HalfEdgeList.Count; i++)
            {
                HalfEdge he = HalfEdgeList[i].TempHalfEdge;
                he.Pair = dic[HalfEdgeList[i].PairID];
                he.Next = dic[HalfEdgeList[i].NextID];
                he.Prev = dic[HalfEdgeList[i].PrevID];
            }

            ret.FaceStore = MpUtil_v1002.HeFaceListFromMp(FaceStore, dic);

            ret.HeIdProvider.Counter = HeIdCount;

            ret.FaceIdProvider.Counter = FaceIdCount;

            return(ret);
        }
Beispiel #12
0
 public void StoreChildList(CadFigure fig)
 {
     ChildList = MpUtil_v1002.FigureListToMp_v1002(fig.ChildList);
 }