示例#1
0
 internal static void parseFields(IfcGeometricRepresentationContext c, List <string> arrFields, ref int ipos)
 {
     IfcRepresentationContext.parseFields(c, arrFields, ref ipos);
     c.mCoordinateSpaceDimension = ParserSTEP.ParseInt(arrFields[ipos++]);
     c.mPrecision             = ParserSTEP.ParseDouble(arrFields[ipos++]);
     c.mWorldCoordinateSystem = ParserSTEP.ParseLink(arrFields[ipos++]);
     c.mTrueNorth             = ParserSTEP.ParseLink(arrFields[ipos++]);
 }
示例#2
0
		internal static void parseFields(IfcRepresentationContext c, List<string> arrFields, ref int ipos) { c.mContextIdentifier = arrFields[ipos++].Replace("'", ""); c.mContextType = arrFields[ipos++].Replace("'", ""); }
示例#3
0
 internal override void ParseXml(XmlElement xml)
 {
     base.ParseXml(xml);
     if (xml.HasAttribute("ObjectType"))
     {
         ObjectType = xml.Attributes["ObjectType"].Value;
     }
     if (xml.HasAttribute("LongName"))
     {
         LongName = xml.Attributes["LongName"].Value;
     }
     if (xml.HasAttribute("Phase"))
     {
         Phase = xml.Attributes["Phase"].Value;
     }
     foreach (XmlNode child in xml.ChildNodes)
     {
         string name = child.Name;
         if (string.Compare(name, "RepresentationContexts") == 0)
         {
             foreach (XmlNode cn in child.ChildNodes)
             {
                 IfcRepresentationContext rc = mDatabase.ParseXml <IfcRepresentationContext>(cn as XmlElement);
                 if (rc != null)
                 {
                     addRepresentationContext(rc);
                 }
             }
         }
         else if (string.Compare(name, "UnitsInContext") == 0)
         {
             UnitsInContext = mDatabase.ParseXml <IfcUnitAssignment>(child as XmlElement);
         }
         else if (string.Compare(name, "IsDefinedBy") == 0)
         {
             foreach (XmlNode cn in child.ChildNodes)
             {
                 IfcRelDefinesByProperties rd = mDatabase.ParseXml <IfcRelDefinesByProperties>(cn as XmlElement);
                 if (rd != null)
                 {
                     rd.AddRelated(this);
                 }
             }
         }
         else if (string.Compare(name, "Declares") == 0)
         {
             foreach (XmlNode cn in child.ChildNodes)
             {
                 IfcRelDeclares rd = mDatabase.ParseXml <IfcRelDeclares>(cn as XmlElement);
                 if (rd != null)
                 {
                     rd.RelatingContext = this;
                 }
             }
         }
     }
     if (this as IfcProjectLibrary == null || mDatabase.mContext == null)
     {
         mDatabase.mContext = this;
     }
 }
示例#4
0
		protected IfcRepresentationContext(IfcRepresentationContext p) : base() { mContextIdentifier = p.mContextIdentifier; mContextType = p.mContextType; }
示例#5
0
        internal override void parseJObject(JObject obj)
        {
            base.parseJObject(obj);
            JObject jobj = obj.GetValue("ContextOfItems", StringComparison.InvariantCultureIgnoreCase) as JObject;

            if (jobj != null)
            {
                JToken tok = jobj["href"];
                if (tok != null)
                {
                    mContextOfItems = tok.Value <int>();
                }
                else
                {
                    IfcRepresentationContext rc = extractObject <IfcRepresentationContext>(jobj);
                    IfcContext context          = mDatabase.Context;
                    if (context != null)
                    {
                        foreach (IfcRepresentationContext repContext in context.RepresentationContexts)
                        {
                            IfcGeometricRepresentationSubContext gsc = rc as IfcGeometricRepresentationSubContext;
                            if (gsc != null)
                            {
                                IfcGeometricRepresentationContext grc = repContext as IfcGeometricRepresentationContext;
                                if (grc != null)
                                {
                                    foreach (IfcGeometricRepresentationSubContext sub in grc.HasSubContexts)
                                    {
                                        if (string.Compare(sub.mContextIdentifier, gsc.mContextIdentifier, true) == 0)
                                        {
                                            ContextOfItems       = sub;
                                            mDatabase[rc.mIndex] = null;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (mContextOfItems == 0)
                    {
                        ContextOfItems = rc;
                    }
                }
            }
            JToken token = obj.GetValue("RepresentationIdentifier", StringComparison.InvariantCultureIgnoreCase);

            if (token != null)
            {
                RepresentationIdentifier = token.Value <string>();
            }
            token = obj.GetValue("RepresentationType", StringComparison.InvariantCultureIgnoreCase);
            if (token != null)
            {
                RepresentationType = token.Value <string>();
            }
            mDatabase.extractJArray <IfcRepresentationItem>(obj.GetValue("Items", StringComparison.InvariantCultureIgnoreCase) as JArray).ForEach(x => addItem(x));

            List <IfcPresentationLayerAssignment> assignments = mDatabase.extractJArray <IfcPresentationLayerAssignment>(obj.GetValue("LayerAssignments", StringComparison.InvariantCultureIgnoreCase) as JArray);

            foreach (IfcPresentationLayerAssignment a in assignments)
            {
                a.addItem(this);
            }
        }