Ejemplo n.º 1
0
        public static MpLayer_v1001 Create(CadLayer layer)
        {
            MpLayer_v1001 ret = new MpLayer_v1001();

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

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

            return(ret);
        }
Ejemplo n.º 2
0
        public NurbsLine Restore()
        {
            NurbsLine nurbs = new NurbsLine();

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

            nurbs.BSplineP = BSplineP.Restore();

            return(nurbs);
        }
Ejemplo n.º 3
0
        public static MpNurbsLine_v1001 Create(NurbsLine src)
        {
            MpNurbsLine_v1001 ret = new MpNurbsLine_v1001();

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

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

            return(ret);
        }
Ejemplo n.º 4
0
        public BSplineParam Restore()
        {
            BSplineParam bs = new BSplineParam();

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

            return(bs);
        }
Ejemplo n.º 5
0
        public static MpBSplineParam_v1001 Create(BSplineParam src)
        {
            MpBSplineParam_v1001 ret = new MpBSplineParam_v1001();

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

            return(ret);
        }
Ejemplo n.º 6
0
        public static MpCadObjectDB_v1001 Create(CadObjectDB db)
        {
            MpCadObjectDB_v1001 ret = new MpCadObjectDB_v1001();

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

            ret.FigureList = MpUtil_v1001.FigureMapToMp_v1001(db.FigureMap);

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

            ret.CurrentLayerID = db.CurrentLayerID;

            return(ret);
        }
Ejemplo n.º 7
0
        public CadObjectDB Restore()
        {
            CadObjectDB ret = new CadObjectDB();

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

            // Figure map
            List <CadFigure> figList = MpUtil_v1001.FigureListFromMp_v1001(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_v1001 mpfig = FigureList[i];
                SetFigChild(mpfig, dic);
            }


            // Layer map
            ret.LayerList = MpUtil_v1001.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);
        }
Ejemplo n.º 8
0
        public NurbsSurface Restore()
        {
            NurbsSurface nurbs = new NurbsSurface();

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

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

            nurbs.CtrlPoints = MpUtil_v1001.VertexListFromMp(CtrlPoints);

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

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

            return(nurbs);
        }
Ejemplo n.º 9
0
        public static MpHeModel_v1001 Create(HeModel model)
        {
            MpHeModel_v1001 ret = new MpHeModel_v1001();

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

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

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

            ret.HeIdCount = model.HeIdProvider.Counter;

            ret.FaceIdCount = model.FaceIdProvider.Counter;

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

            ret.HalfEdgeList = MpUtil_v1001.HalfEdgeListToMp(heList);

            return(ret);
        }
Ejemplo n.º 10
0
        public HeModel Restore()
        {
            HeModel ret = new HeModel();

            ret.VertexStore = MpUtil_v1001.VertexListFromMp(VertexStore);

            ret.NormalStore = MpUtil_v1001.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_v1001.HeFaceListFromMp(FaceStore, dic);

            ret.HeIdProvider.Counter = HeIdCount;

            ret.FaceIdProvider.Counter = FaceIdCount;

            return(ret);
        }
Ejemplo n.º 11
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_v1001.FigureListFromMp_v1001(ChildList);

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

            fig.GeometricDataFromMp_v1001(GeoData);
        }
Ejemplo n.º 12
0
 public void StoreChildList(CadFigure fig)
 {
     ChildList = MpUtil_v1001.FigureListToMp_v1001(fig.ChildList);
 }