예제 #1
0
        /// <summary>
        /// Create model serialized from existing xml with a valid ID from the database
        /// </summary>
        /// <param name="dataId">the data id</param>
        /// <param name="modelXML">JSON of model planes (all 11 11x11 planes)</param>
        public DimensionalModelData(long dataId, string modelJson)
        {
            ModelPlanes = new HashSet <IDimensionalModelPlane>();

            var backingModel = ReferenceWrapper.GetOne <DimensionalModelData>(dataId);

            ID          = backingModel.ID;
            Name        = backingModel.Name;
            Created     = backingModel.Created;
            LastRevised = backingModel.LastRevised;
            ModelType   = backingModel.ModelType;

            DeserializeModel(modelJson);
        }
예제 #2
0
        /// <summary>
        /// Fills a data object with data from a data row
        /// </summary>
        /// <param name="dr">the data row to fill from</param>
        public override void Fill(DataRow dr)
        {
            ID = DataUtility.GetFromDataRow<long>(dr, "ID");
            Created = DataUtility.GetFromDataRow<DateTime>(dr, "Created");
            LastRevised = DataUtility.GetFromDataRow<DateTime>(dr, "LastRevised");
            Name = DataUtility.GetFromDataRow<string>(dr, "Name");
            ModelType = (DimensionalModelType)DataUtility.GetFromDataRow<short>(dr, "ModelType");

            string outModel = DataUtility.GetFromDataRow<string>(dr, "Model");
            DeserializeModel(outModel);
        }
예제 #3
0
 /// <summary>
 /// Create model serialized from a comma delimited string of an 11x11 plane
 /// </summary>
 /// <param name="delimitedPlane">comma delimited string of an 11x11 plane</param>
 public DimensionalModelData(string delimitedPlanes, DimensionalModelType type)
 {
     ModelType = type;
     ModelPlanes = new HashSet<IDimensionalModelPlane>();
     SerializeModelFromDelimitedList(delimitedPlanes);
 }
예제 #4
0
 /// <summary>
 /// Create model serialized from a comma delimited string of an 21x21 plane
 /// </summary>
 /// <param name="delimitedPlane">comma delimited string of an 21x21 plane</param>
 public DimensionalModelData(string delimitedPlanes, DimensionalModelType type)
 {
     ModelType   = type;
     ModelPlanes = new HashSet <IDimensionalModelPlane>();
     SerializeModelFromDelimitedList(delimitedPlanes);
 }