Example #1
0
        private void DeserializeData(AttributeData data)
        {
            ClearNodeList();
            var count          = data.ReadAttributeInteger("Count");
            var referenceNodes = new List <Node>();
            var shapeTypes     = new List <int>();
            var shapeIndexes   = new List <int>();

            for (var position = 0; position < count; position++)
            {
                var node = data.ReadAttributeReference("Node" + position, Parent);
                referenceNodes.Add(node);
                shapeTypes.Add(data.ReadAttributeInteger("ShapeType" + position));
                shapeIndexes.Add(data.ReadAttributeInteger("ShapeIndex" + position));
            }

            var pos = 0;

            foreach (var node in referenceNodes)
            {
                var entity = new SceneSelectedEntity
                {
                    Node       = node,
                    ShapeType  = (TopAbsShapeEnum)shapeTypes[pos],
                    ShapeCount = shapeIndexes[pos]
                };
                Nodes.Add(entity);

                pos++;
            }
            RegisterNodeList();
            OnModified();
        }
        private SceneSelectedEntity DeserializeSceneSelectedEntity(AttributeData data)
        {
            var result = new SceneSelectedEntity(data.ReadAttributeReference("Value", Parent))
            {
                ShapeCount = data.ReadAttributeInteger("ShapeCount"),
                ShapeType  = (TopAbsShapeEnum)data.ReadAttributeInteger("ShapeType")
            };

            return(result);
        }
 private void SerializeData(SceneSelectedEntity referenceData, AttributeData data)
 {
     if (Node == null)
     {
         data.WriteAttribute("Value", string.Empty);
         return;
     }
     data.WriteAttribute("Value", Parent, referenceData.Node);
     data.WriteAttribute("ShapeCount", referenceData.ShapeCount);
     data.WriteAttribute("ShapeType", (int)referenceData.ShapeType);
 }
 private void SetReferenceData(SceneSelectedEntity value)
 {
     if (value == null)
     {
         _data = value;
         Node  = null;
         return;
     }
     if (_data == null)
     {
         _data = new SceneSelectedEntity();
     }
     _data.ShapeCount = value.ShapeCount;
     _data.ShapeType  = value.ShapeType;
     Node             = value.Node;
 }
Example #5
0
 public static TopoDSShape ExtractSubShape(SceneSelectedEntity sceneSelectedEntity)
 {
     return(ExtractSubShape(sceneSelectedEntity.Node,
                            sceneSelectedEntity.ShapeCount,
                            sceneSelectedEntity.ShapeType));
 }