internal IfcGeometricRepresentationSubContext(DatabaseIfc db, IfcGeometricRepresentationSubContext s, DuplicateOptions options) : base(db, s, options) { IfcGeometricRepresentationContext parent = s.ParentContext; if (parent != null) { IfcGeometricRepresentationContext.GeometricContextIdentifier contextId = IfcGeometricRepresentationContext.GeometricContextIdentifier.Model; if (Enum.TryParse <IfcGeometricRepresentationSubContext.GeometricContextIdentifier>(s.ContextType, out contextId)) { IfcGeometricRepresentationContext existing = null; if (db.Factory.mContexts.TryGetValue(contextId, out existing)) { ParentContext = existing; } } } if (ParentContext == null) { ParentContext = db.Factory.Duplicate(s.ParentContext, options) as IfcGeometricRepresentationContext; } mTargetScale = s.mTargetScale; mTargetView = s.mTargetView; mUserDefinedTargetView = s.mUserDefinedTargetView; IfcGeometricRepresentationSubContext.SubContextIdentifier id = IfcGeometricRepresentationSubContext.SubContextIdentifier.Axis; if (Enum.TryParse <IfcGeometricRepresentationSubContext.SubContextIdentifier>(ContextIdentifier, out id)) { db.Factory.mSubContexts[id] = this; } }
private DatabaseIfc(bool generate, Schema schema, ModelView view) { mSchema = schema; mModelView = view; #if (RHINO) mModelSIScale = 1 / GGYM.Units.mLengthConversion[(int)GGYM.GGYMRhino.GGRhino.ActiveUnits()]; Tolerance = Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance; #endif if (mSchema == Schema.IFC2x3 || mSchema == Schema.IFC4) { OwnerHistory(IfcChangeActionEnum.ADDED); } mGeomRepContxt = new IfcGeometricRepresentationContext(this, 3, Tolerance) { ContextType = "Model" }; mGeoRepSubContxtAxis = new IfcGeometricRepresentationSubContext(mGeomRepContxt, 0, IfcGeometricProjectionEnum.MODEL_VIEW) { ContextIdentifier = "Axis" }; mGeoRepSubContxtBody = new IfcGeometricRepresentationSubContext(mGeomRepContxt, 0, IfcGeometricProjectionEnum.MODEL_VIEW) { ContextIdentifier = "Body" }; if (generate) { initData(); } }
internal static void parseFields(IfcGeometricRepresentationSubContext c, List <string> arrFields, ref int ipos) { IfcGeometricRepresentationContext.parseFields(c, arrFields, ref ipos); c.mContainerContext = ParserSTEP.ParseLink(arrFields[ipos++]); c.mTargetScale = ParserSTEP.ParseDouble(arrFields[ipos++]); c.mTargetView = (IfcGeometricProjectionEnum)Enum.Parse(typeof(IfcGeometricProjectionEnum), arrFields[ipos++].Replace(".", "")); c.mUserDefinedTargetView = arrFields[ipos++]; }
internal IfcGeometricRepresentationSubContext(IfcGeometricRepresentationSubContext p) : base(p) { mContainerContext = p.mContainerContext; mTargetScale = p.mTargetScale; mTargetView = p.mTargetView; mUserDefinedTargetView = p.mUserDefinedTargetView; }
internal IfcGeometricRepresentationSubContext(DatabaseIfc db, IfcGeometricRepresentationSubContext s) : base(db, s) { ParentContext = db.Factory.Duplicate(s.ParentContext) as IfcGeometricRepresentationContext; mTargetScale = s.mTargetScale; mTargetView = s.mTargetView; mUserDefinedTargetView = s.mUserDefinedTargetView; }
public enum SubContextIdentifier { Axis, Body, BoundingBox, FootPrint, PlanSymbol3d, PlanSymbol2d }; // Surface }; public IfcGeometricRepresentationSubContext SubContext(SubContextIdentifier nature) { IfcGeometricRepresentationSubContext result = null; if (mSubContexts.TryGetValue(nature, out result)) { return(result); } string identifier = "Body"; IfcGeometricProjectionEnum projection = IfcGeometricProjectionEnum.MODEL_VIEW; IfcGeometricRepresentationContext context = null; if (nature == SubContextIdentifier.Axis) { identifier = "Axis"; projection = IfcGeometricProjectionEnum.GRAPH_VIEW; } else if (nature == SubContextIdentifier.BoundingBox) { projection = IfcGeometricProjectionEnum.MODEL_VIEW; identifier = "Box"; } else if (nature == SubContextIdentifier.FootPrint) { identifier = "FootPrint"; } else if (nature == SubContextIdentifier.PlanSymbol3d) { projection = IfcGeometricProjectionEnum.PLAN_VIEW; identifier = "Annotation"; } else if (nature == SubContextIdentifier.PlanSymbol2d) { projection = IfcGeometricProjectionEnum.PLAN_VIEW; identifier = "Annotation"; context = GeometricRepresentationContext(ContextIdentifier.Annotation); } if (context == null) { context = GeometricRepresentationContext(ContextIdentifier.Model); } result = new IfcGeometricRepresentationSubContext(context, projection) { ContextIdentifier = identifier }; mSubContexts.Add(nature, result); return(result); }
internal IfcGeometricRepresentationContext(DatabaseIfc db, IfcGeometricRepresentationContext c, DuplicateOptions options) : base(db, c, options) { mCoordinateSpaceDimension = c.mCoordinateSpaceDimension; mPrecision = c.mPrecision; if (c.mWorldCoordinateSystem != null) { WorldCoordinateSystem = db.Factory.Duplicate <IfcAxis2Placement>(c.mWorldCoordinateSystem); } if (c.mTrueNorth != null) { TrueNorth = db.Factory.Duplicate(c.TrueNorth) as IfcDirection; } if (options.DuplicateDownstream) { foreach (IfcGeometricRepresentationSubContext sc in c.mHasSubContexts) { db.Factory.Duplicate(sc, options); } } if (c.mHasCoordinateOperation != null) { db.Factory.Duplicate(c.mHasCoordinateOperation, options); } IfcGeometricRepresentationSubContext subContext = this as IfcGeometricRepresentationSubContext; if (subContext == null) { IfcGeometricRepresentationContext.GeometricContextIdentifier id = IfcGeometricRepresentationContext.GeometricContextIdentifier.Model; if (Enum.TryParse <IfcGeometricRepresentationContext.GeometricContextIdentifier>(ContextType, out id)) { db.Factory.mContexts[id] = this; } if (db.Context != null) { db.Context.RepresentationContexts.Add(this); } } }
internal override void ParseXml(XmlElement xml) { base.ParseXml(xml); if (xml.HasAttribute("CoordinateSpaceDimension")) { CoordinateSpaceDimension = int.Parse(xml.Attributes["CoordinateSpaceDimension"].Value); } if (xml.HasAttribute("Precision")) { Precision = double.Parse(xml.Attributes["Precision"].Value); } foreach (XmlNode child in xml.ChildNodes) { string name = child.Name; if (string.Compare(name, "WorldCoordinateSystem") == 0) { WorldCoordinateSystem = mDatabase.ParseXml <IfcAxis2Placement3D>(child as XmlElement); } else if (string.Compare(name, "TrueNorth") == 0) { TrueNorth = mDatabase.ParseXml <IfcDirection>(child as XmlElement); } else if (string.Compare(name, "HasSubContexts") == 0) { List <IfcGeometricRepresentationSubContext> subs = new List <IfcGeometricRepresentationSubContext>(); foreach (XmlNode node in child.ChildNodes) { IfcGeometricRepresentationSubContext sub = mDatabase.ParseXml <IfcGeometricRepresentationSubContext>(node as XmlElement); if (sub != null) { sub.ContainerContext = this; } } } else if (string.Compare(name, "HasCoordinateOperation") == 0) { HasCoordinateOperation = mDatabase.ParseXml <IfcCoordinateOperation>(child as XmlElement); } } }
public IfcGeometricRepresentationSubContext SubContext(SubContextIdentifier nature) { if (nature == SubContextIdentifier.Axis) { if (mSubContxtAxis == null) { mSubContxtAxis = new IfcGeometricRepresentationSubContext(mGeomRepContxt, IfcGeometricProjectionEnum.MODEL_VIEW) { ContextIdentifier = "Axis" } } ; return(mSubContxtAxis); } else if (nature == SubContextIdentifier.PlanSymbol) { if (mSubContxtPlanSymbol == null) { mSubContxtPlanSymbol = new IfcGeometricRepresentationSubContext(mGeomRepContxt, IfcGeometricProjectionEnum.PLAN_VIEW) { ContextIdentifier = "Annotation" } } ; return(mSubContxtPlanSymbol); } if (mSubContxtBody == null) { mSubContxtBody = new IfcGeometricRepresentationSubContext(mGeomRepContxt, IfcGeometricProjectionEnum.MODEL_VIEW) { ContextIdentifier = "Body" } } ; return(mSubContxtBody); }
private DatabaseIfc(bool generate,Schema schema, ModelView view) { mSchema = schema; mModelView = view; #if(RHINO) mModelSIScale = 1 / GGYM.Units.mLengthConversion[(int) GGYM.GGYMRhino.GGRhino.ActiveUnits()]; Tolerance = Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance; #endif if (mSchema == Schema.IFC2x3 || mSchema == Schema.IFC4) { OwnerHistory(IfcChangeActionEnum.ADDED); } mGeomRepContxt = new IfcGeometricRepresentationContext(this, 3, Tolerance) { ContextType = "Model" }; mGeoRepSubContxtAxis = new IfcGeometricRepresentationSubContext(mGeomRepContxt, 0, IfcGeometricProjectionEnum.MODEL_VIEW) { ContextIdentifier = "Axis" }; mGeoRepSubContxtBody = new IfcGeometricRepresentationSubContext(mGeomRepContxt, 0, IfcGeometricProjectionEnum.MODEL_VIEW) { ContextIdentifier = "Body" }; if (generate) initData(); }
internal static void parseFields(IfcGeometricRepresentationSubContext c, List<string> arrFields, ref int ipos) { IfcGeometricRepresentationContext.parseFields(c, arrFields, ref ipos); c.mContainerContext = ParserSTEP.ParseLink(arrFields[ipos++]); c.mTargetScale = ParserSTEP.ParseDouble(arrFields[ipos++]); c.mTargetView = (IfcGeometricProjectionEnum)Enum.Parse(typeof(IfcGeometricProjectionEnum), arrFields[ipos++].Replace(".", "")); c.mUserDefinedTargetView = arrFields[ipos++]; }
internal new static IfcGeometricRepresentationSubContext Parse(string strDef) { IfcGeometricRepresentationSubContext c = new IfcGeometricRepresentationSubContext(); int ipos = 0; parseFields(c, ParserSTEP.SplitLineFields(strDef), ref ipos); return c; }
internal void setAggregate(BaseClassIfc obj) { IfcProduct product = obj as IfcProduct; if (product != null) { mProducts.Add(product); IfcBuildingStorey buildingStorey = obj as IfcBuildingStorey; if (buildingStorey != null) { mBuildingStories.Add(buildingStorey); } IfcGrid grid = obj as IfcGrid; if (grid != null) { mGrids.Add(grid); } IfcSlab slab = product as IfcSlab; if (slab != null) { mSlabs.Add(slab); } IfcStructuralItem structuralItem = obj as IfcStructuralItem; if (structuralItem != null) { mStructItems.Add(structuralItem); } IfcWall wall = product as IfcWall; if (wall != null) { mWalls.Add(wall); } return; } //IfcApplication application = obj as IfcApplication; //if (application != null) // mApplications.Add(application); IfcComplexProperty cp = obj as IfcComplexProperty; if (cp != null) { mComplexProperties.Add(cp); return; } IfcCoordinateOperation coordOp = obj as IfcCoordinateOperation; if (coordOp != null) { mCoordinateOperations.Add(coordOp); return; } IfcEdgeCurve edgeCurve = obj as IfcEdgeCurve; if (edgeCurve != null) { mEdgeCurves.Add(edgeCurve); return; } IfcExternalReferenceRelationship externalReferenceRelationship = obj as IfcExternalReferenceRelationship; if (externalReferenceRelationship != null) { mExternalRelationships.Add(externalReferenceRelationship); return; } //IfcExtrudedAreaSolid extrudedAreaSolid = result as IfcExtrudedAreaSolid; //if(extrudedAreaSolid != null) //{ // if(result as IfcExtrudedAreaSolidTapered == null) // aggregate.mExtrusions.Add(extrudedAreaSolid); // return extrudedAreaSolid; //} IfcGeometricRepresentationSubContext geometricRepresentationContext = obj as IfcGeometricRepresentationSubContext; if (geometricRepresentationContext != null) { mGeomContexts.Add(geometricRepresentationContext); return; } IfcGroup group = obj as IfcGroup; if (group != null) { IfcZone zone = group as IfcZone; if (zone != null) { mZones.Add(zone); return; } mGroups.Add(group); return; } IfcIndexedColourMap indexedColourMap = obj as IfcIndexedColourMap; if (indexedColourMap != null) { mIndexedColourMap.Add(indexedColourMap); return; } IfcIndexedTextureMap indexedTextureMap = obj as IfcIndexedTextureMap; if (indexedTextureMap != null) { mIndexedTextureMap.Add(indexedTextureMap); return; } IfcLocalPlacement localPlacement = obj as IfcLocalPlacement; if (localPlacement != null) { mLocalPlacements.Add(localPlacement); return; } IfcMappedItem mi = obj as IfcMappedItem; if (mi != null) { mMappedItems.Add(mi); return; } IfcMaterial material = obj as IfcMaterial; if (material != null) { mMaterials.Add(material); return; } IfcMaterialProperties materialProperties = obj as IfcMaterialProperties; if (materialProperties != null) { mMaterialProperties.Add(materialProperties); return; } IfcMaterialPropertiesSuperSeded materialPropertiesSS = obj as IfcMaterialPropertiesSuperSeded; if (materialPropertiesSS != null) { mMaterialPropertiesSS.Add(materialPropertiesSS); return; } // IfcMechanicalFastener mechanicalFastener = result as IfcMechanicalFastener; //if(mechanicalFastener != null) //{ // mFasteners.Add(mechanicalFastener); // return mechanicalFastener; //} //IfcOwnerHistory ownerHistory = result as IfcOwnerHistory; //if(ownerHistory != null) //{ // mOwnHistories.Add(ownerHistory); // return ownerHistory; //} IfcPresentationLayerAssignment presentationLayerAssignment = obj as IfcPresentationLayerAssignment; if (presentationLayerAssignment != null) { mPresentationLayerAssignments.Add(presentationLayerAssignment); return; } IfcProductRepresentation productRepresentation = obj as IfcProductRepresentation; if (productRepresentation != null) { mProductReps.Add(productRepresentation); return; } IfcPropertySet propSet = obj as IfcPropertySet; if (propSet != null) { mPropertySets.Add(propSet); return; } //IfcProfileDef profileDef = obj as IfcProfileDef; //if (profileDef != null) //{ // mProfiles.Add(profileDef); // return profileDef; //} IfcRelationship relationship = obj as IfcRelationship; if (relationship != null) { mRelationships.Add(relationship); return; } IfcRepresentation representation = obj as IfcRepresentation; if (representation != null) { mRepresentations.Add(representation); return; } //IfcRepresentationMap representationMap = obj as IfcRepresentationMap; //if (representationMap != null) //{ // mRepMaps.Add(representationMap); // return representationMap; //} IfcResourceConstraintRelationship rcr = obj as IfcResourceConstraintRelationship; if (rcr != null) { mConstraintRelationships.Add(rcr); return; } IfcShapeAspect shapeAspect = obj as IfcShapeAspect; if (shapeAspect != null) { mShapeAspects.Add(shapeAspect); return; } IfcStyledItem styledItem = obj as IfcStyledItem; if (styledItem != null) { mStyledItems.Add(styledItem); return; } IfcTypeProduct typeProduct = obj as IfcTypeProduct; if (typeProduct != null) { mTypeProducts.Add(typeProduct); return; } setCustomAggregate(obj); }
internal new static IfcGeometricRepresentationSubContext Parse(string strDef) { IfcGeometricRepresentationSubContext c = new IfcGeometricRepresentationSubContext(); int ipos = 0; parseFields(c, ParserSTEP.SplitLineFields(strDef), ref ipos); return(c); }
internal IfcGeometricRepresentationSubContext(DatabaseIfc db, IfcGeometricRepresentationSubContext s) : base(db, s) { ContainerContext = db.Factory.Duplicate(s.ContainerContext) as IfcGeometricRepresentationContext; mTargetScale = s.mTargetScale; mTargetView = s.mTargetView; mUserDefinedTargetView = s.mUserDefinedTargetView; }
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); } }