Inheritance: GeometryGym.STEP.STEPEntity, IBaseClassIfc
Beispiel #1
0
 internal override void SetXML(XmlElement xml, BaseClassIfc host, HashSet<int> processed)
 {
     base.SetXML(xml, host, processed);
     if (mDimensions > 0)
         xml.AppendChild(Dimensions.GetXML(xml.OwnerDocument, "Dimensions", this, processed));
     xml.SetAttribute("UnitType", mUnitType.ToString().ToLower());
 }
Beispiel #2
0
 internal override void SetXML(XmlElement xml, BaseClassIfc host, HashSet<int> processed)
 {
     base.SetXML(xml, host, processed);
     xml.AppendChild(ContainerProfile.GetXML(xml.OwnerDocument, "ContainerProfile", this, processed));
     xml.AppendChild(Operator.GetXML(xml.OwnerDocument, "Operator", this, processed));
     setAttribute(xml, "Label", Label);
 }
Beispiel #3
0
 protected override void setJSON(JObject obj, BaseClassIfc host, HashSet<int> processed)
 {
     base.setJSON(obj, host, processed);
     obj["XLength"] = XLength.ToString();
     obj["YLength"] = YLength.ToString();
     obj["ZLength"] = ZLength.ToString();
 }
Beispiel #4
0
 protected override void setJSON(JObject obj, BaseClassIfc host, HashSet<int> processed)
 {
     base.setJSON(obj, host, processed);
     obj["Points"] = Points.getJson(this, processed);
     if (mSegments.Count > 0)
     {
         JArray array = new JArray();
         obj["Segments"] = array;
         foreach (IfcSegmentIndexSelect seg in Segments)
         {
             IfcArcIndex ai = seg as IfcArcIndex;
             JObject jobj = new JObject();
             if (ai != null)
             {
                 jobj["IfcArcIndex"] = ai.mA + " " + ai.mB + " " + ai.mC;
             }
             else
             {
                 IfcLineIndex li = seg as IfcLineIndex;
                 jobj["IfcLineIndex"] = string.Join(" ", li.mIndices.ConvertAll(x => x.ToString()));
             }
             array.Add(jobj);
         }
     }
     if (mSelfIntersect != IfcLogicalEnum.UNKNOWN)
         obj["SelfIntersect"] = mSelfIntersect.ToString();
 }
Beispiel #5
0
		protected override void setJSON(JObject obj, BaseClassIfc host, HashSet<int> processed)
		{
			base.setJSON(obj, host, processed);
			string tag = Tag;
			if (!string.IsNullOrEmpty(tag))
				obj["Tag"] = tag;
		}
        internal XmlElement GetXML(XmlDocument doc,string name, BaseClassIfc host, HashSet<int> processed)
        {
            string type = KeyWord;
            if (string.IsNullOrEmpty(name))
                name = type;

            if (processed.Contains(mIndex))
            {
                XmlElement xelement = doc.CreateElement(name);//, mDatabase.mXmlNamespace);
                XmlAttribute nil = doc.CreateAttribute("xsi", "nil", mDatabase.mXsiNamespace);
                nil.Value = "true";
                xelement.SetAttributeNode(nil);
                xelement.SetAttribute("href", "i" + mIndex);
                return xelement;
            }

            XmlElement element = doc.CreateElement(name);//, mDatabase.mXmlNamespace);
            SetXML(element, host, processed);

            element.SetAttribute("id", "i" + mIndex);
            if (string.Compare(name, type) != 0)
            {
                XmlAttribute att = doc.CreateAttribute("xsi","type",mDatabase.mXsiNamespace);
                //att.Prefix = "xsi";
                //att.LocalName = type;
                att.Value = type;
                element.SetAttributeNode(att);
            }
            processed.Add(mIndex);
            return element;
        }
Beispiel #7
0
 protected override void setJSON(JObject obj, BaseClassIfc host,  HashSet<int> processed)
 {
     base.setJSON(obj, host, processed);
     IfcDimensionalExponents exponents = Dimensions;
     if(exponents != null)
         obj["Dimensions"] = exponents.getJson(this, processed);
     obj["UnitType"] = mUnitType.ToString();
 }
Beispiel #8
0
 protected override void setJSON(JObject obj, BaseClassIfc host,  HashSet<int> processed)
 {
     base.setJSON(obj, host, processed);
     JArray array = new JArray();
     foreach(int unit in mUnits)
         array.Add(mDatabase[unit].getJson(this, processed));
     obj["Units"] = array;
 }
Beispiel #9
0
 protected override void setJSON(JObject obj, BaseClassIfc host,  HashSet<int> processed)
 {
     base.setJSON(obj, host, processed);
     setAttribute(obj, "Description", Description);
     setAttribute(obj, "Language", Language);
     if (mReferencedLibrary > 0)
         obj["ReferencedLibrary"] = ReferencedLibrary.getJson(this, processed);
 }
 protected override void setJSON(JObject obj, BaseClassIfc host, List<BaseClassIfc> prime)
 {
     base.setJSON(obj, host, prime);
     if(!double.IsNaN(mStartDistAlong))
         mJsonObject["StartDistAlong"] = mStartDistAlong;
     JArray array = new JArray();
     foreach (IfcAlignment2DHorizontalSegment seg in Segments)
         array.Add(seg.getJson(this,prime));
     mJsonObject["Segments"] = array;
 }
Beispiel #11
0
 internal override void SetXML(XmlElement xml, BaseClassIfc host, HashSet<int> processed)
 {
     base.SetXML(xml, host, processed);
     xml.SetAttribute("Eastings", mEastings.ToString());
     xml.SetAttribute("Northings", mNorthings.ToString());
     xml.SetAttribute("OrthogonalHeight", mOrthogonalHeight.ToString());
     setAttribute(xml, "XAxisAbscissa", mXAxisAbscissa);
     setAttribute(xml, "XAxisOrdinate", mXAxisOrdinate);
     setAttribute(xml, "Scale", mScale);
 }
Beispiel #12
0
 internal override void SetXML(XmlElement xml, BaseClassIfc host, HashSet<int> processed)
 {
     base.SetXML(xml, host, processed);
     xml.SetAttribute("Name", Name);
     setAttribute(xml, "Version", Version);
     if (mPublisher > 0)
         xml.AppendChild(mDatabase[mPublisher].GetXML(xml.OwnerDocument, "Publisher", this, processed));
     //VersionDate
     setAttribute(xml, "Location", Location);
     setAttribute(xml, "Description", Description);
 }
Beispiel #13
0
 protected override void setJSON(JObject obj, BaseClassIfc host,  HashSet<int> processed)
 {
     base.setJSON(obj, host, processed);
     obj["Name"] = Name;
     setAttribute(obj, "Version", Version);
     if (mPublisher > 0)
         obj["Publisher"] = mDatabase[mPublisher].getJson(this, processed);
     //VersionDate
     setAttribute(obj, "Location", Location);
     setAttribute(obj, "Description", Description);
 }
Beispiel #14
0
		protected override void setJSON(JObject obj, BaseClassIfc host, HashSet<int> processed)
		{
			base.setJSON(obj, host, processed);
			setAttribute(obj, "TypeIdentifier", TypeIdentifier);
			setAttribute(obj, "AttributeIdentifier", AttributeIdentifier);
			setAttribute(obj, "InstanceName", InstanceName);
			if (mListPositions.Count > 0)
				obj["ListPositions"] = new JArray(mListPositions.ToArray());
			if (mInnerReference > 0)
				obj["InnerReference"] = InnerReference.getJson(this, processed);
		}
Beispiel #15
0
		protected override void setJSON(JObject obj, BaseClassIfc host, HashSet<int> processed)
		{
			base.setJSON(obj, host, processed);
			JArray array = new JArray();
			if (!mRelatedObjects.Contains(host.mIndex))
			{
				foreach (IfcObjectDefinition od in RelatedObjects)
					array.Add(od.getJson(this, processed));
				obj["RelatedObjects"] = array;
			}
		}
Beispiel #16
0
		internal override void SetXML(XmlElement xml, BaseClassIfc host, HashSet<int> processed)
		{
			base.SetXML(xml, host, processed);
			Tuple<double, double> tuple = mCoordList[0];
			string str = tuple.Item1 + " " + tuple.Item2;
			for (int icounter = 1; icounter < mCoordList.Length; icounter++)
			{
				tuple = mCoordList[icounter];
				str += " " + tuple.Item1 + " " + tuple.Item2;
			}
			xml.SetAttribute("CoordList", str);
		}
Beispiel #17
0
 internal override void SetXML(XmlElement xml, BaseClassIfc host, HashSet<int> processed)
 {
     base.SetXML(xml, host, processed);
     xml.SetAttribute("Depth", mDepth.ToString());
     xml.SetAttribute("FlangeWidth", mFlangeWidth.ToString());
     xml.SetAttribute("WebThickness", mWebThickness.ToString());
     xml.SetAttribute("FlangeThickness", mFlangeThickness.ToString());
     if (!double.IsNaN(mFilletRadius))
         xml.SetAttribute("FilletRadius", mFilletRadius.ToString());
     if (!double.IsNaN(mEdgeRadius))
         xml.SetAttribute("EdgeRadius", mEdgeRadius.ToString());
 }
Beispiel #18
0
 protected override void setJSON(JObject obj, BaseClassIfc host, HashSet<int> processed)
 {
     base.setJSON(obj, host, processed);
     obj["Eastings"] = mEastings;
     obj["Northings"] = mNorthings;
     obj["OrthogonalHeight"] = mOrthogonalHeight;
     if (!double.IsNaN(mXAxisAbscissa))
         obj["XAxisAbscissa"] = mXAxisAbscissa;
     if (!double.IsNaN(mXAxisOrdinate))
         obj["XAxisOrdinate"] = mXAxisOrdinate;
     if (!double.IsNaN(mScale))
         obj["Scale"] = mScale;
 }
Beispiel #19
0
 protected override void setJSON(JObject obj, BaseClassIfc host, HashSet<int> processed)
 {
     base.setJSON(obj, host, processed);
     if (mElements.Count > 0)
     {
         JArray array = new JArray();
         foreach (int i in mElements)
             array.Add(mDatabase[i].getJson(this, processed));
         obj["Elements"] = array;
     }
     base.setAttribute(obj, "UnitType", mUnitType.ToString());
     base.setAttribute(obj, "UserDefinedType", UserDefinedType);
 }
Beispiel #20
0
 internal override void SetXML(XmlElement xml, BaseClassIfc host, HashSet<int> processed)
 {
     base.SetXML(xml, host, processed);
     XmlElement element = xml.OwnerDocument.CreateElement("ShapeRepresentations");
     xml.AppendChild(element);
     foreach (IfcShapeModel s in ShapeRepresentations)
         element.AppendChild(s.GetXML(xml.OwnerDocument, "", this, processed));
     setAttribute(xml, "Name", Name);
     setAttribute(xml, "Description", Description);
     xml.SetAttribute("ProductDefinitional", ProductDefinitional.ToString().ToLower());
     if (mPartOfProductDefinitionShape > 0)
         xml.AppendChild(mDatabase[mPartOfProductDefinitionShape].GetXML(xml.OwnerDocument, "PartOfProductDefinitionShape", this, processed));
 }
Beispiel #21
0
		protected override void setJSON(JObject obj, BaseClassIfc host, HashSet<int> processed)
		{
			base.setJSON(obj, host, processed);
			JArray array = new JArray();
			foreach (IfcShapeModel sm in ShapeRepresentations)
				array.Add(sm.getJson(this, processed));
			obj["ShapeRepresentations"] = array;
			setAttribute(obj, "Name", Name);
			setAttribute(obj, "Description", Description);
			setAttribute(obj, "ProductDefinitional", mProductDefinitional.ToString());
			if (mPartOfProductDefinitionShape > 0 && mPartOfProductDefinitionShape != host.mIndex)
				obj["PartOfProductDefinitionShape"] = mDatabase[mPartOfProductDefinitionShape].getJson(this, processed);
		}
Beispiel #22
0
 internal override void SetXML(XmlElement xml, BaseClassIfc host, HashSet<int> processed)
 {
     base.SetXML(xml, host, processed);
     setAttribute(xml, "ObjectType", ObjectType);
     if (mIsTypedBy != null)
         xml.AppendChild(mIsTypedBy.GetXML(xml.OwnerDocument, "IsTypedBy", this, processed));
     if (mIsDefinedBy.Count > 0)
     {
         XmlElement element = xml.OwnerDocument.CreateElement("IsDefinedBy");
         xml.AppendChild(element);
         foreach (IfcRelDefinesByProperties rd in IsDefinedBy)
             element.AppendChild(rd.GetXML(xml.OwnerDocument, "", this, processed));
     }
 }
Beispiel #23
0
 protected override void setJSON(JObject obj, BaseClassIfc host, HashSet<int> processed)
 {
     base.setJSON(obj, host, processed);
     obj["Coordinates"] = mDatabase[mCoordinates].getJson(this, processed);
     if (mHasColours != null)
         obj["HasColours"] = mHasColours.getJson(this, processed);
     if (mHasTextures.Count > 0)
     {
         JArray array = new JArray(mHasTextures.Count);
         foreach (IfcIndexedTextureMap tm in HasTextures)
             array.Add(tm.getJson(this, processed));
         obj["HasTextures"] = array;
     }
 }
Beispiel #24
0
 protected override void setJSON(JObject obj, BaseClassIfc host,  HashSet<int> processed)
 {
     base.setJSON(obj, host, processed);
     setAttribute(obj, "ObjectType", ObjectType);
     if (mIsTypedBy != null)
         obj["IsTypedBy"] = mIsTypedBy.getJson(this, processed);
     if (mIsDefinedBy.Count > 0)
     {
         JArray array = new JArray();
         foreach (IfcRelDefinesByProperties rdp in mIsDefinedBy)
             array.Add(rdp.getJson(this, processed));
         obj["IsDefinedBy"] = array;
     }
 }
Beispiel #25
0
 protected override void setJSON(JObject obj, BaseClassIfc host, HashSet<int> processed)
 {
     base.setJSON(obj, host, processed);
     if(!double.IsNaN(mPhysicalWeight))
         obj["PhysicalWeight"] = mPhysicalWeight;
     if(!double.IsNaN(mPerimeter))
         obj["Perimeter"] = mPerimeter;
     if(!double.IsNaN(mMinimumPlateThickness))
         obj["MinimumPlateThickness"] = mMinimumPlateThickness;
     if(!double.IsNaN(mMaximumPlateThickness))
         obj["MaximumPlateThickness"] = mMaximumPlateThickness;
     if(!double.IsNaN(mCrossSectionArea))
         obj["CrossSectionArea"] = mCrossSectionArea;
 }
 protected override void setJSON(JObject obj, BaseClassIfc host, List<BaseClassIfc> prime)
 {
     base.setJSON(obj, host, prime);
     if (mPredefinedType != IfcAlignmentTypeEnum.NOTDEFINED)
         mJsonObject["PredefinedType"] = mPredefinedType.ToString();
     IfcAlignment2DHorizontal horizontal = Horizontal;
     if (horizontal != null)
         mJsonObject["Horizontal"] = horizontal.getJson(this, prime);
     IfcAlignment2DVertical vertical = Vertical;
     if (vertical != null)
         mJsonObject["Vertical"] = vertical.getJson(this, prime);
     string str = LinearRefMethod;
     if (!string.IsNullOrEmpty(str))
         mJsonObject["LinearRefMethod"] = str;
 }
Beispiel #27
0
        protected override void setJSON(JObject obj, BaseClassIfc host,  HashSet<int> processed)
        {
            base.setJSON(obj, host, processed);

            if(mNormals.Length > 0)
            {
                JArray array = new JArray() { };
                foreach (Tuple<double, double, double> normal in Normals)
                {
                    JArray norm = new JArray() { };
                    norm.Add(normal.Item1);
                    norm.Add(normal.Item2);
                    norm.Add(normal.Item3);
                    array.Add(norm);
                }
                obj["Normals"] = array;
            }
            obj["Closed"] = Closed;
            JArray arr = new JArray();
            foreach(Tuple<int,int,int> coord in mCoordIndex)
            {
                JArray c = new JArray();
                c.Add(coord.Item1);
                c.Add(coord.Item2);
                c.Add(coord.Item3);
                arr.Add(c);
            }
            obj["CoordIndex"] = arr;
            if(mNormalIndex.Length > 0)
            {
                arr = new JArray();
                foreach (Tuple<int, int, int> norm in mNormalIndex)
                {
                    JArray n = new JArray();
                    n.Add(norm.Item1);
                    n.Add(norm.Item2);
                    n.Add(norm.Item3);
                    arr.Add(n);
                }
                obj["NormalIndex"] = arr;

            }
        }
Beispiel #28
0
 internal override void SetXML(XmlElement xml, BaseClassIfc host, HashSet<int> processed)
 {
     base.SetXML(xml, host, processed);
     xml.AppendChild(Points.GetXML(xml.OwnerDocument, "Points", this, processed));
     if (mSegments.Count > 0)
     {
         XmlElement element = xml.OwnerDocument.CreateElement("Segments");
         xml.AppendChild(element);
         foreach (IfcSegmentIndexSelect seg in Segments)
         {
             XmlElement s = xml.OwnerDocument.CreateElement(seg.GetType().Name + "-wrapper");
             element.AppendChild(s);
             IfcArcIndex ai = seg as IfcArcIndex;
             if (ai != null)
                 s.InnerText = ai.mA + " " + ai.mB + " " + ai.mC;
             else
             {
                 IfcLineIndex li = seg as IfcLineIndex;
                 s.InnerText = string.Join(" ", li.mIndices.ConvertAll(x => x.ToString()));
             }
         }
     }
 }
Beispiel #29
0
 protected override void setJSON(JObject obj, BaseClassIfc host, HashSet<int> processed)
 {
     base.setJSON(obj, host, processed);
     string identification = Identification;
     if (!string.IsNullOrEmpty(identification))
         obj["Identification"] = identification;
     string familyName = FamilyName;
     if (!string.IsNullOrEmpty(familyName))
         obj["FamilyName"] = familyName;
     string givenName = GivenName;
     if (!string.IsNullOrEmpty(givenName))
         obj["GivenName"] = givenName;
     if (mMiddleNames.Count > 0)
     {
         JArray array = new JArray();
         IEnumerable<string> middleNames = MiddleNames;
         foreach (string name in middleNames)
             array.Add(name);
         obj["MiddleNames"] = array;
     }
     List<IfcActorRole> roles = Roles;
     if (roles.Count > 0)
     {
         JArray array = new JArray();
         foreach (IfcActorRole role in roles)
             array.Add(role.getJson(this, processed));
         obj["Roles"] = array;
     }
     List<IfcAddress> addresses = Addresses;
     if (addresses.Count > 0)
     {
         JArray array = new JArray();
         foreach (IfcAddress address in addresses)
             array.Add(address.getJson(this, processed));
         obj["Addresses"] = array;
     }
 }
Beispiel #30
0
        internal override void SetXML(XmlElement xml, BaseClassIfc host, HashSet<int> processed)
        {
            base.SetXML(xml, host, processed);
            if (this as IfcGeometricRepresentationSubContext == null)
            {
                xml.SetAttribute("CoordinateSpaceDimension", mCoordinateSpaceDimension.ToString());
                if (!double.IsNaN(mPrecision))
                    xml.SetAttribute("Precision", mPrecision.ToString());
                if (mWorldCoordinateSystem > 0)
                    xml.AppendChild(mDatabase[mWorldCoordinateSystem].GetXML(xml.OwnerDocument, "WorldCoordinateSystem", this, processed));
                if (mTrueNorth > 0)
                    xml.AppendChild(TrueNorth.GetXML(xml.OwnerDocument, "TrueNorth", this, processed));
            }
            if (mHasSubContexts.Count > 0)
            {
                XmlElement element = xml.OwnerDocument.CreateElement("HasSubContexts");
                foreach (IfcGeometricRepresentationSubContext sub in mHasSubContexts)
                    element.AppendChild(sub.GetXML(xml.OwnerDocument, "", this, processed));
                xml.AppendChild(element);
            }

            if (mHasCoordinateOperation != null)
                xml.AppendChild(HasCoordinateOperation.GetXML(xml.OwnerDocument, "HasCoordinateOperation", this, processed));
        }
Beispiel #31
0
 internal override void SetXML(XmlElement xml, BaseClassIfc host, Dictionary <int, XmlElement> processed)
 {
     base.SetXML(xml, host, processed);
     xml.AppendChild(convert(xml.OwnerDocument, mValueComponent, "ValueComponent"));
     xml.AppendChild(mDatabase[mUnitComponent].GetXML(xml.OwnerDocument, "UnitComponent", this, processed));
 }
 protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
 {
     base.setJSON(obj, host, options);
     obj["Orientation"] = Orientation.getJson(this, options);
     obj["Magnitude"]   = Magnitude;
 }
Beispiel #33
0
 internal SetJsonOptions(BaseClassIfc obj)
 {
     adopt(obj);
 }
Beispiel #34
0
 protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
 {
     base.setJSON(obj, host, options);
     obj["Factor"] = mFactor;
 }
 protected override void setJSON(JObject obj, BaseClassIfc host, HashSet <int> processed)
 {
     base.setJSON(obj, host, processed);
     obj["EdgeStart"] = mDatabase[mEdgeStart].getJson(this, processed);
     obj["EdgeEnd"]   = mDatabase[mEdgeEnd].getJson(this, processed);
 }
 protected override void setJSON(JObject obj, BaseClassIfc host, HashSet <int> processed)
 {
     base.setJSON(obj, host, processed);
     base.setAttribute(obj, "MethodOfMeasurement", MethodOfMeasurement);
     obj["Quantities"] = new JArray(Quantities.ConvertAll(x => x.getJson(this, processed)));
 }
Beispiel #37
0
 protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
 {
     base.setJSON(obj, host, options);
     obj["XDim"] = XDim;
     obj["YDim"] = YDim;
 }
        internal T ParseXml <T>(XmlElement xml) where T : IBaseClassIfc
        {
            if (xml == null)
            {
                return(default(T));
            }
            if (xml.HasAttribute("ref"))
            {
                string str = xml.Attributes["ref"].Value;
                if (mParsed.ContainsKey(str))
                {
                    return((T)(IBaseClassIfc)mParsed[str]);
                }
                if (xml.HasAttribute("xsi:nil"))
                {
                    string query = string.Format("//*[@id='{0}']", str);
                    xml = (XmlElement)xml.OwnerDocument.SelectSingleNode(query);
                    if (xml == null)
                    {
                        return(default(T));
                    }
                }
            }
            else if (xml.HasAttribute("href"))
            {
                string str = xml.Attributes["href"].Value;
                if (mParsed.ContainsKey(str))
                {
                    return((T)(IBaseClassIfc)mParsed[str]);
                }
                if (xml.HasAttribute("xsi:nil"))
                {
                    string query = string.Format("//*[@id='{0}']", str);                     // or "//book[@id='{0}']"
                    xml = (XmlElement)xml.OwnerDocument.SelectSingleNode(query);
                    if (xml == null)
                    {
                        return(default(T));
                    }
                }
            }
            string id = (xml.HasAttribute("id") ? xml.Attributes["id"].Value : "");

            if (!string.IsNullOrEmpty(id) && mParsed.ContainsKey(id))
            {
                return((T)(IBaseClassIfc)mParsed[id]);
            }

            string keyword = xml.HasAttribute("xsi:type") ? xml.Attributes["xsi:type"].Value : xml.Name;
            Type   type    = Type.GetType("GeometryGym.Ifc." + keyword, false, true);

            if (type == null)
            {
                type = typeof(T);
            }
            if (type.IsAbstract)
            {
                IEnumerable <Type> types = type.Assembly.GetTypes().Where(x => x != type && type.IsAssignableFrom(x));
                if (types != null && types.Count() == 1)
                {
                    type = types.First();
                }
            }
            ConstructorInfo constructor = type.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
                                                              null, Type.EmptyTypes, null);

            if (constructor != null)
            {
                BaseClassIfc entity = constructor.Invoke(new object[] { }) as BaseClassIfc;
                if (entity != null)
                {
                    int index = NextBlank;
                    if (!string.IsNullOrEmpty(id))
                    {
                        int i = 0;
                        if (id[0] == 'i')
                        {
                            if (int.TryParse(id.Substring(1), out i))
                            {
                                if (this[i] == null)
                                {
                                    index = i;
                                }
                            }
                        }
                    }
                    this[index] = entity;
                    entity.ParseXml(xml);
                    if (xml.HasAttribute("id"))
                    {
                        string str = xml.Attributes["id"].Value;
                        if (!mParsed.ContainsKey(str))
                        {
                            mParsed.Add(str, entity);
                        }
                    }
                    return((T)(IBaseClassIfc)entity);
                }
            }

            if (xml.HasChildNodes && xml.ChildNodes.Count == 1)
            {
                return(ParseXml <T>(xml.ChildNodes[0] as XmlElement));
            }
            return(default(T));
        }
Beispiel #39
0
 internal SetJsonOptions(SetJsonOptions options, BaseClassIfc obj) : this(options) { adopt(obj); }
        protected void ReplaceDatabase(BaseClassIfc revised)
        {
            IfcRoot thisRoot = this as IfcRoot, revisedRoot = revised as IfcRoot;

            if (thisRoot != null && revisedRoot != null)
            {
                revisedRoot.GlobalId     = thisRoot.GlobalId;
                revisedRoot.OwnerHistory = thisRoot.OwnerHistory;
                revisedRoot.Name         = thisRoot.Name;
                revisedRoot.Description  = thisRoot.Description;
                IfcObjectDefinition thisObjectDefinition = this as IfcObjectDefinition, revisedObjectDefinition = revised as IfcObjectDefinition;
                if (thisObjectDefinition != null && revisedObjectDefinition != null)
                {
                    foreach (IfcRelAggregates rel in thisObjectDefinition.IsDecomposedBy.ToList())
                    {
                        rel.RelatingObject = revisedObjectDefinition;
                    }
                    foreach (IfcRelNests rel in thisObjectDefinition.IsNestedBy.ToList())
                    {
                        rel.RelatingObject = revisedObjectDefinition;
                    }

                    IfcRelAggregates relAggregates = thisObjectDefinition.Decomposes;
                    if (relAggregates != null)
                    {
                        relAggregates.RelatedObjects.Remove(thisObjectDefinition);
                        relAggregates.RelatedObjects.Add(revisedObjectDefinition);
                    }
                    IfcRelNests relNests = thisObjectDefinition.Nests;
                    if (relNests != null)
                    {
                        relNests.RelatedObjects.Remove(thisObjectDefinition);
                        relNests.RelatedObjects.Add(thisObjectDefinition);
                    }

                    foreach (IfcRelDefinesByProperties relDefinesByProperties in thisObjectDefinition.mIsDefinedBy.ToList())
                    {
                        relDefinesByProperties.RelatedObjects.Remove(thisObjectDefinition);
                        relDefinesByProperties.RelatedObjects.Add(revisedObjectDefinition);
                    }

                    foreach (IfcRelAssigns assigns in thisObjectDefinition.HasAssignments.ToList())
                    {
                        assigns.RelatedObjects.Remove(thisObjectDefinition);
                        assigns.RelatedObjects.Add(revisedObjectDefinition);
                    }
                    IfcRelDeclares relDeclares = thisObjectDefinition.HasContext;
                    if (relDeclares != null)
                    {
                        relDeclares.RelatedDefinitions.Remove(thisObjectDefinition);
                        relDeclares.RelatedDefinitions.Add(revisedObjectDefinition);
                    }
                    foreach (IfcRelAssociates associates in thisObjectDefinition.HasAssociations.ToList())
                    {
                        associates.RelatedObjects.Remove(thisObjectDefinition);
                        associates.RelatedObjects.Add(revisedObjectDefinition);
                    }
                    IfcObject thisObject = this as IfcObject, revisedObject = revised as IfcObject;
                    if (thisObject != null && revisedObject != null)
                    {
                        if (!string.IsNullOrEmpty(thisObject.ObjectType))
                        {
                            revisedObject.ObjectType = thisObject.ObjectType;
                        }

                        if (thisObject.mIsTypedBy != null)
                        {
                            thisObject.mIsTypedBy.mRelatedObjects.Remove(thisObject);
                        }
                        IfcProduct thisProduct = this as IfcProduct, revisedProduct = revised as IfcProduct;
                        if (thisProduct != null && revisedProduct != null)
                        {
                            IfcRelContainedInSpatialStructure containedInSpatialStructure = thisProduct.mContainedInStructure;
                            if (containedInSpatialStructure != null)
                            {
                                containedInSpatialStructure.RelatedElements.Remove(thisProduct);
                                containedInSpatialStructure.RelatedElements.Add(revisedProduct);
                            }
                            IfcElement thisElement = this as IfcElement, revisedElement = revised as IfcElement;
                            if (thisElement != null && revisedElement != null)
                            {
                                revisedElement.Tag = thisElement.Tag;
                            }
                            IfcSpatialElement thisSpatial = this as IfcSpatialElement, revisedSpatial = revised as IfcSpatialElement;
                            if (thisSpatial != null && revisedSpatial != null)
                            {
                                foreach (IfcRelContainedInSpatialStructure contained in thisSpatial.ContainsElements.ToList())
                                {
                                    contained.RelatingStructure = revisedSpatial;
                                }
                            }
                            else if (revisedSpatial != null && thisElement != null)
                            {
                                if (containedInSpatialStructure != null)
                                {
                                    containedInSpatialStructure.RelatedElements.Remove(revisedProduct);
                                    containedInSpatialStructure.RelatingStructure.AddAggregated(revisedProduct);
                                }
                                List <IfcProduct> subProducts = thisObjectDefinition.IsDecomposedBy.SelectMany(x => x.RelatedObjects).OfType <IfcProduct>().ToList();
                                if (subProducts.Count > 0)
                                {
                                    new IfcRelContainedInSpatialStructure(subProducts, revisedSpatial);
                                }
                                foreach (IfcRelAssociatesMaterial associates in revisedSpatial.HasAssociations.OfType <IfcRelAssociatesMaterial>().ToList())
                                {
                                    associates.RelatedObjects.Remove(revisedSpatial);
                                }

                                IfcFacilityPart facilityPart = revisedSpatial as IfcFacilityPart;
                                if (facilityPart != null)
                                {
                                    IfcFacility facility = revisedSpatial.FindHost <IfcFacility>();
                                    if (facility != null)
                                    {
                                        facility.AddAggregated(revisedSpatial);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        IfcTypeObject thisTypeObject = this as IfcTypeObject, revisedTypeObject = revised as IfcTypeObject;
                        if (thisTypeObject != null && revisedTypeObject != null)
                        {
                            IfcTypeProduct thisTypeProduct = this as IfcTypeProduct, revisedTypeProduct = revised as IfcTypeProduct;
                            if (thisTypeProduct != null && revisedTypeProduct != null)
                            {
                                revisedTypeProduct.Tag = thisTypeProduct.Tag;
                                IfcElementType thisElementType = this as IfcElementType, revisedElementType = revised as IfcElementType;
                                if (thisElementType != null && revisedElementType != null)
                                {
                                    revisedElementType.ElementType = thisElementType.ElementType;
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                IfcRepresentationItem representationItem = this as IfcRepresentationItem, revisedItem = revised as IfcRepresentationItem;
                if (representationItem != null && revisedItem != null)
                {
                    IfcStyledItem styledItem = representationItem.StyledByItem;
                    if (styledItem != null)
                    {
                        styledItem.Item = revisedItem;
                    }

                    foreach (IfcShapeModel shapeModel in representationItem.mRepresents.ToList())
                    {
                        shapeModel.Items.Remove(representationItem);
                        shapeModel.Items.Add(revisedItem);
                    }
                    IfcPresentationLayerAssignment layerAssignment = representationItem.mLayerAssignment;
                    if (layerAssignment != null)
                    {
                        layerAssignment.AssignedItems.Remove(representationItem);
                        layerAssignment.AssignedItems.Add(revisedItem);
                    }
                }
            }
            mDatabase[revised.mIndex] = null;
            revised.mIndex            = mIndex;
            mDatabase[mIndex]         = revised;
        }
 internal virtual bool isDuplicate(BaseClassIfc e, double tol)
 {
     return(true);
 }
Beispiel #42
0
 internal override void SetXML(XmlElement xml, BaseClassIfc host, Dictionary <string, XmlElement> processed)
 {
     base.SetXML(xml, host, processed);
     xml.SetAttribute("PredefinedType", mPredefinedType.ToString().ToLower());
 }
Beispiel #43
0
 //internal int mCoordinates;// :    IfcCartesianPointList;
 internal override void SetXML(XmlElement xml, BaseClassIfc host, Dictionary <string, XmlElement> processed)
 {
     base.SetXML(xml, host, processed);
     xml.AppendChild(Coordinates.GetXML(xml.OwnerDocument, "Coordinates", this, processed));
 }
 protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
 {
     base.setJSON(obj, host, options);
     obj["VertexGeometry"] = VertexGeometry.getJson(this, options);
 }
Beispiel #45
0
 internal override void SetXML(XmlElement xml, BaseClassIfc host, Dictionary <int, XmlElement> processed)
 {
     base.SetXML(xml, host, processed);
     //xml.AppendChild(RepresentedMaterial.GetXML(xml.OwnerDocument, "RepresentedMaterial", this, processed));
 }
Beispiel #46
0
 protected BaseClassIfc(DatabaseIfc db, BaseClassIfc e) : base()
 {
     mGlobalId = e.mGlobalId; db.appendObject(this); db.Factory.mDuplicateMapping.AddObject(e, mIndex);
 }
Beispiel #47
0
        public static void setJSON(IfcColourOrFactor colourOrFactor, string name, JObject obj, BaseClassIfc host, SetJsonOptions options)
        {
            if (colourOrFactor == null)
            {
                return;
            }
            IfcNormalisedRatioMeasure normalisedRatioMeasure = colourOrFactor as IfcNormalisedRatioMeasure;

            if (normalisedRatioMeasure != null)
            {
                obj[name] = DatabaseIfc.extract(normalisedRatioMeasure);
            }
            else
            {
                obj[name] = (colourOrFactor as BaseClassIfc).getJson(host, options);
            }
        }
Beispiel #48
0
 internal override void SetXML(XmlElement xml, BaseClassIfc host, Dictionary <int, XmlElement> processed)
 {
     base.SetXML(xml, host, processed);
     xml.AppendChild(mDatabase[mRelatingMaterial].GetXML(xml.OwnerDocument, "RelatingMaterial", this, processed));
 }
Beispiel #49
0
 protected void createArray(JObject obj, string name, IEnumerable <IBaseClassIfc> objects, BaseClassIfc host, SetJsonOptions options)
 {
     if (objects.Count() == 0)
     {
         return;
     }
     obj[name] = new JArray(objects.ToList().ConvertAll(x => mDatabase[x.Index].getJson(host, options)));
 }
Beispiel #50
0
 internal override void SetXML(XmlElement xml, BaseClassIfc host, Dictionary <int, XmlElement> processed)
 {
     base.SetXML(xml, host, processed);
     xml.SetAttribute("XDim", mXDim.ToString());
     xml.SetAttribute("YDim", mYDim.ToString());
 }
Beispiel #51
0
 protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
 {
     base.setJSON(obj, host, options);
     obj["RelatingPropertyDefinition"] = RelatingPropertyDefinition.getJson(this, options);
 }
Beispiel #52
0
 internal override void SetXML(XmlElement xml, BaseClassIfc host, Dictionary <int, XmlElement> processed)
 {
     base.SetXML(xml, host, processed);
     xml.AppendChild(RelatingStructure.GetXML(xml.OwnerDocument, "RelatingStructure", this, processed));
 }
Beispiel #53
0
 protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
 {
     base.setJSON(obj, host, options);
     obj["RoundingRadius"] = RoundingRadius;
 }
Beispiel #54
0
        protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
        {
            base.setJSON(obj, host, options);
            //internal List<IfcRelAssigns> mHasAssignments = new List<IfcRelAssigns>();//	 :  SET OF IfcRelAssigns FOR RelatedObjects;
            //internal IfcRelNests mNests = null;//	 :	SET [0:1] OF IfcRelNests FOR RelatedObjects;
            //internal List<IfcRelNests> mIsNestedBy = new List<IfcRelNests>();//	 :	SET OF IfcRelNests FOR RelatingObject;
            //internal IfcRelDeclares mHasContext = null;// :	SET [0:1] OF IfcRelDeclares FOR RelatedDefinitions;
            //internal List<IfcRelAggregates> mIsDecomposedBy = new List<IfcRelAggregates>();//	 :  SET OF IfcRelDecomposes FOR RelatingObject;

            if (mHasAssignments.Count > 0)
            {
                JArray array = new JArray();
                foreach (IfcRelAssigns ra in HasAssignments)
                {
                    if (host == null || ra.mIndex != host.mIndex)
                    {
                        array.Add(ra.getJson(this, options));
                    }
                }
                if (array.Count > 0)
                {
                    obj["HasAssignments"] = array;
                }
            }
            if (options.Style != SetJsonOptions.JsonStyle.Repository)
            {
                if (mIsNestedBy.Count > 0)
                {
                    JArray array = new JArray();
                    foreach (IfcRelNests rn in IsNestedBy)
                    {
                        array.Add(rn.getJson(this, options));
                    }
                    obj["IsNestedBy"] = array;
                }
                if (mIsDecomposedBy.Count > 0)
                {
                    JArray array = new JArray();
                    foreach (IfcRelAggregates agg in IsDecomposedBy)
                    {
                        array.Add(agg.getJson(this, options));
                    }
                    obj["IsDecomposedBy"] = array;
                }
            }
            if (mHasAssociations.Count > 0)
            {
                JArray array = new JArray();
                foreach (IfcRelAssociates agg in HasAssociations)
                {
                    array.Add(agg.getJson(this, options));
                }
                obj["HasAssociations"] = array;
            }

            if (mIsDefinedBy.Count > 0 && options.Style != SetJsonOptions.JsonStyle.Repository)
            {
                JArray array = new JArray();
                foreach (IfcRelDefinesByProperties rdp in mIsDefinedBy)
                {
                    array.Add(rdp.getJson(this, options));
                }
                obj["IsDefinedBy"] = array;
            }
        }
Beispiel #55
0
 internal override void SetXML(XmlElement xml, BaseClassIfc host, Dictionary <int, XmlElement> processed)
 {
     base.SetXML(xml, host, processed);
     xml.AppendChild(Axis.GetXML(xml.OwnerDocument, "Axis", this, processed));
     xml.SetAttribute("Angle", mAngle.ToString());
 }
 protected override void setJSON(JObject obj, BaseClassIfc host, HashSet <int> processed)
 {
     base.setJSON(obj, host, processed);
     obj["VertexGeometry"] = VertexGeometry.getJson(this, processed);
 }
Beispiel #57
0
 internal override void SetXML(XmlElement xml, BaseClassIfc host, Dictionary <int, XmlElement> processed)
 {
     base.SetXML(xml, host, processed);
     xml.SetAttribute("RoundingRadius", mRoundingRadius.ToString());
 }
Beispiel #58
0
 internal override void SetXML(XmlElement xml, BaseClassIfc host, Dictionary <int, XmlElement> processed)
 {
     base.SetXML(xml, host, processed);
     setAttribute(xml, "Intent", Intent);
     xml.AppendChild(RelatingConstraint.GetXML(xml.OwnerDocument, "RelatingConstraint", this, processed));
 }
 public JObject getJson(BaseClassIfc host, BaseClassIfc.SetJsonOptions options)
 {
     return(DatabaseIfc.extract(this));
 }
Beispiel #60
0
 protected void ReplaceDatabase(BaseClassIfc revised)
 {
     mDatabase[revised.mIndex] = null;
     revised.mIndex            = mIndex;
     mDatabase[mIndex]         = revised;
 }