diff --git a/CityBIM/Builder/AlkisBuilder.cs b/CityBIM/Builder/AlkisBuilder.cs deleted file mode 100644 index 530782a4..00000000 --- a/CityBIM/Builder/AlkisBuilder.cs +++ /dev/null @@ -1,162 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -using Autodesk.Revit.DB; -using Autodesk.Revit.DB.ExtensibleStorage; -using Autodesk.Revit.DB.Architecture; - -using BIMGISInteropLibs.Geometry; -using BIMGISInteropLibs.Alkis; -using BIMGISInteropLibs.Semantic; -using CityBIM.Calc; - -namespace CityBIM.Builder -{ - class AlkisBuilder - { - private readonly Document doc; - - public AlkisBuilder(Document doc) - { - this.doc = doc; - } - - public void buildRevitObjectsFromAlkisList(List alkisList, bool drapeOnTerrain) - { - var queryGroups = from aaaObj in alkisList - group aaaObj by aaaObj.UsageType into usageGroup - select usageGroup; - - ElementId terrainID = utils.getHTWDDTerrainID(doc); - - foreach (var group in queryGroups) - { - ElementId RefPlaneId = (terrainID == null) ? null : terrainID; - string groupName = group.Key; - List objList = group.ToList(); - - //When no DTM is availabe -> alkisObjects are mapped flat - if (RefPlaneId == null || drapeOnTerrain == false) - { - var refSurfPts = createRefSurfacePointsForObjGroup(objList); - List reducedPoints = refSurfPts.Select(p => GeorefCalc.CalcUnprojectedPoint(p, true)).ToList(); - List RevitPts = reducedPoints.Select(p => Revit_Build.GetRevPt(p)).ToList(); - - using (Transaction trans = new Transaction(doc, "Create RefPlane")) - { - trans.Start(); - TopographySurface refSurf = TopographySurface.Create(doc, RevitPts); - refSurf.Pinned = true; - - Parameter nameParam = refSurf.LookupParameter("Name"); - nameParam.Set("RefPlane_" + groupName); - - RefPlaneId = refSurf.Id; - trans.Commit(); - } - } - - //When alkisObjects should be mapped on DTM data - else - { - using (Transaction trans = new Transaction(doc, "Copy DTM as new RefPlane")) - { - trans.Start(); - TopographySurface refSurf = doc.GetElement(RefPlaneId) as TopographySurface; - var copyOfRefSurfId = ElementTransformUtils.CopyElement(doc, refSurf.Id, new XYZ(0, 0, 0)); - - TopographySurface copiedRefSurf = doc.GetElement(copyOfRefSurfId.First()) as TopographySurface; - copiedRefSurf.Pinned = true; - - //var label = LabelUtils.GetLabelFor(BuiltInParameter.ALL_MODEL_TYPE_NAME); - //Parameter nameParam = copiedRefSurf.LookupParameter(label); - //nameParam.Set("RefPlane_" + groupName); - Parameter nameParam = copiedRefSurf.LookupParameter("Name"); - nameParam.Set("RefPlane_" + groupName); - - RefPlaneId = copiedRefSurf.Id; - trans.Commit(); - } - } - - Schema currentSchema = utils.getSchemaByName(groupName); - - using (Transaction trans = new Transaction(doc, "Create alkisObjs")) - { - trans.Start(); - foreach (var alkisObj in objList) - { - var siteSubRegion = createSiteSubRegion(alkisObj, RefPlaneId); - - //var label = LabelUtils.GetLabelFor(BuiltInParameter.ALL_MODEL_TYPE_NAME); - //Parameter nameParam = siteSubRegion.TopographySurface.LookupParameter(label); - //nameParam.Set(groupName); - Parameter nameParam = siteSubRegion.TopographySurface.LookupParameter("Name"); - nameParam.Set(groupName); - - //Add Attributes - Entity ent = new Entity(currentSchema); - var fieldList = currentSchema.ListFields(); - var fieldNameList = new List(); - - foreach (var field in fieldList) - { - fieldNameList.Add(field.FieldName); - } - - Field gmlid = currentSchema.GetField("gmlid"); - ent.Set(gmlid, alkisObj.Gmlid); - - foreach (KeyValuePair entry in alkisObj.Attributes) - { - if (fieldNameList.Contains(entry.Key.Name)) - { - Field currentField = currentSchema.GetField(entry.Key.Name); - ent.Set(currentField, entry.Value); - } - } - - TopographySurface topoSurface = siteSubRegion.TopographySurface; - topoSurface.SetEntity(ent); - } - trans.Commit(); - } - - } - } - - private SiteSubRegion createSiteSubRegion(AX_Object obj, ElementId hostId) - { - List polyExt = obj.getOuterRing(); - List> polysInt = obj.getInnerRings(); - - List loopList = Revit_Build.CreateExteriorCurveLoopList(polyExt, polysInt, out XYZ normal); - SiteSubRegion siteSubRegion = SiteSubRegion.Create(doc, loopList, hostId); - return siteSubRegion; - } - - private static List createRefSurfacePointsForObjGroup(List objList) - { - List pointList = new List(); - foreach (var xplanObj in objList) - { - foreach (var segment in xplanObj.Segments) - { - foreach (var point in segment) - { - pointList.Add(point); - } - } - } - - var ptList = pointList.ConvertAll(p => new Calc.Point(p.X, p.Y)); - var convexHull = Calc.ConvexHull.MakeHull(ptList); - - var C2BPtList = convexHull.Select(p => new C2BPoint(p.x, p.y, 0)); - - return C2BPtList.ToList(); - } - - } -} diff --git a/CityBIM/Builder/RevitCityBuilder.cs b/CityBIM/Builder/CityBuilder.cs similarity index 94% rename from CityBIM/Builder/RevitCityBuilder.cs rename to CityBIM/Builder/CityBuilder.cs index 0325a1ba..24b75689 100644 --- a/CityBIM/Builder/RevitCityBuilder.cs +++ b/CityBIM/Builder/CityBuilder.cs @@ -1,43 +1,38 @@ -using Autodesk.Revit.DB; -using BIMGISInteropLibs.Geometry; -using BIMGISInteropLibs.Semantic; -using BIMGISInteropLibs.Logging; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Xml.Linq; -using System.Collections.ObjectModel; -using CityBIM.GUI; + +using Autodesk.Revit.DB; using Autodesk.Revit.DB.ExtensibleStorage; + using BIMGISInteropLibs.CityGML; +using BIMGISInteropLibs.Geometry; +using BIMGISInteropLibs.Logging; +using BIMGISInteropLibs.Semantic; +using CityBIM.GUI; + namespace CityBIM.Builder { - internal class RevitCityBuilder + internal class CityBuilder : RevitBuilder { private readonly C2BPoint gmlCorner; - private readonly Document doc; - private readonly List buildings; private readonly Dictionary colors; - private readonly CityGml_Codelist.Codelist CodeTranslation; - public RevitCityBuilder(Document doc, List buildings, C2BPoint gmlCorner, HashSet attributes, CityGml_Codelist.Codelist codeType = CityGml_Codelist.Codelist.none) + public CityBuilder(Document doc, List buildings, C2BPoint gmlCorner, HashSet attributes, + CityGml_Codelist.Codelist codeType = CityGml_Codelist.Codelist.none) : base(doc) { - this.doc = doc; this.buildings = buildings; this.gmlCorner = gmlCorner; this.CodeTranslation = codeType; this.colors = CreateColorAsMaterial(); - createCityGMLSchema(this.doc, attributes); - + createCityGMLSchema(doc, attributes); } - - #region Solid to Revit incl. LOD1-Fallback - /// /// Transforms c2b solids to Revit solid (closed volume) /// @@ -126,9 +121,10 @@ public void CreateBuildings() } allLogs.AddRange(bldg.LogEntries); } - LogWriter.WriteLogFile(allLogs, true, all, success, error, errorLod1, fatalError); + LogWriter.WriteLogFile(allLogs, true, all, success, error, errorLod1, fatalError); } + private void CreateRevitRepresentation(string internalID, C2BSolid solid, List surfaces, Dictionary bldgAttributes, string lod, Dictionary partAttributes = null) { using (TessellatedShapeBuilder builder = new TessellatedShapeBuilder()) @@ -145,7 +141,6 @@ private void CreateRevitRepresentation(string internalID, C2BSolid solid, List loopList = Revit_Build.CreateExteriorCurveLoopList(groundSurface.ExteriorPts, groundSurface.InteriorPts, out XYZ normal, gmlCorner); + List loopList = CreateExteriorCurveLoopList(groundSurface.ExteriorPts, groundSurface.InteriorPts, out XYZ normal, gmlCorner); + if (groundSurface.Facetype == CityGml_Surface.FaceType.outerCeiling) { @@ -273,13 +272,13 @@ orderby v.Position.Z t.Start(); // create direct shape and assign the sphere shape DirectShape ds = DirectShape.CreateElement(doc, new ElementId(BuiltInCategory.OST_Entourage)); - - ds.SetShape(new GeometryObject[] { lod1bldg }); - ds = SetAttributeValues(ds, attributes); - if (partAttributes != null) - ds = SetAttributeValues(ds, partAttributes); - ds.Pinned = true; + ds.SetShape(new GeometryObject[] { lod1bldg }); + + ds = SetAttributeValues(ds, attributes); + if (partAttributes != null) + ds = SetAttributeValues(ds, partAttributes); + ds.Pinned = true; if (height > 20) { @@ -303,7 +302,7 @@ orderby v.Position.Z ds.SetEntity(entity); SetRevitInternalParameters(id, "LOD1 (Fallback from LOD2)", ds); - + t.Commit(); } @@ -344,7 +343,7 @@ orderby v.Position.Z } exteriorHull.Add(new C2BPoint(convexHull.First().x, convexHull.First().y, groundHeight)); //for closed ring - List loopListHull = Revit_Build.CreateExteriorCurveLoopList(exteriorHull, interiorHull, out XYZ normalHull, gmlCorner); + List loopListHull = CreateExteriorCurveLoopList(exteriorHull, interiorHull, out XYZ normalHull, gmlCorner); Solid lod1bldg = GeometryCreationUtilities.CreateExtrusionGeometry(loopListHull, -normalHull, extrHeight); @@ -384,6 +383,7 @@ orderby v.Position.Z } } + private List CreateRevitFaceList(C2BSolid solid, List surfaces) { List faceListT = new List(); @@ -441,9 +441,10 @@ public IList IdentifyFacePoints(int[] vertsPlane, C2BSolid solid) if (verticesXYZ.Contains(verticesXYZ[vid])) { //Transformation for revit - var unprojectedPt = Calc.GeorefCalc.CalcUnprojectedPoint(verticesXYZ[vid].Position, Prop_CityGML_settings.IsGeodeticSystem, gmlCorner); + var unprojectedPt = GetUnprojectedPoint(verticesXYZ[vid].Position, gmlCorner); - var revPt = Revit_Build.GetRevPt(unprojectedPt); + var unprojectedPt_feet = unprojectedPt / 0.3048; + var revPt = this.trafo2RevitCS.OfPoint(new XYZ(unprojectedPt_feet.X, unprojectedPt_feet.Y, unprojectedPt_feet.Z)); facePoints.Add(revPt); } @@ -452,8 +453,6 @@ public IList IdentifyFacePoints(int[] vertsPlane, C2BSolid solid) return facePoints; } - #endregion Solid to Revit incl. LOD1-Fallback - #region Surfaces to Revit public void CreateBuildingsWithFaces() { @@ -519,7 +518,7 @@ public void CreateBuildingsWithFaces() private void CreateRevitFaceRepresentation(CityGml_Surface surface, Dictionary bldgAttributes, string lod, Dictionary partAttributes = null) { - List loopList = Revit_Build.CreateExteriorCurveLoopList(surface.ExteriorPts, surface.InteriorPts, out XYZ normal, gmlCorner); + List loopList = CreateExteriorCurveLoopList(surface.ExteriorPts, surface.InteriorPts, out XYZ normal, gmlCorner); double height = 0.01 / Prop_Revit.feetToM; @@ -847,7 +846,8 @@ private bool createCityGMLSchema(Document doc, HashSet required for reference intersector between dem and gis-data @@ -50,8 +49,8 @@ group geoObject by geoObject.UsageType into usageGroup if (RefPlaneId == null || drapeOnTerrain == false) { var refSurfPts = createRefSurfacePointsForObjGroup(objList); - List reducedPoints = refSurfPts.Select(p => GeorefCalc.CalcUnprojectedPoint(p, true)).ToList(); - List RevitPts = reducedPoints.Select(p => Revit_Build.GetRevPt(p)).ToList(); + List reducedPoints = refSurfPts.Select(p => GetUnprojectedPoint(p)).ToList(); + List RevitPts = reducedPoints.Select(p => GetRevitPt(p)).ToList(); using (Transaction trans = new Transaction(doc, "Create RefPlane")) { @@ -93,7 +92,7 @@ group geoObject by geoObject.UsageType into usageGroup } } - using (Transaction trans = new Transaction(doc, "Create alkisObjs")) + using (Transaction trans = new Transaction(doc, "Create GeoObjects")) { trans.Start(); @@ -458,25 +457,25 @@ private SiteSubRegion createSiteSubRegionFromSegments(List segments, { if (seg.isCurve) { - var unprojectedPntStart = Calc.GeorefCalc.CalcUnprojectedPoint(seg.startPoint, true, null); - var revitPntStart = Revit_Build.GetRevPt(unprojectedPntStart); + var unprojectedPntStart = GetUnprojectedPoint(seg.startPoint); + var revitPntStart = GetRevitPt(seg.startPoint); - var unprojectedPntMid = Calc.GeorefCalc.CalcUnprojectedPoint(seg.midPoint, true, null); - var revitPntMid = Revit_Build.GetRevPt(unprojectedPntMid); + var unprojectedPntMid = GetUnprojectedPoint(seg.midPoint); + var revitPntMid = GetRevitPt(unprojectedPntMid); - var unprojectedPntEnd = Calc.GeorefCalc.CalcUnprojectedPoint(seg.endPoint, true, null); - var revitPntEnd = Revit_Build.GetRevPt(unprojectedPntEnd); + var unprojectedPntEnd = GetUnprojectedPoint(seg.endPoint); + var revitPntEnd = GetRevitPt(unprojectedPntEnd); revitSegmentCurves.Add(Arc.Create(revitPntStart, revitPntEnd, revitPntMid)); } else { - var unprojectedPntStart = Calc.GeorefCalc.CalcUnprojectedPoint(seg.startPoint, true, null); - var revitPntStart = Revit_Build.GetRevPt(unprojectedPntStart); + var unprojectedPntStart = GetUnprojectedPoint(seg.startPoint); + var revitPntStart = GetRevitPt(unprojectedPntStart); - var unprojectedPntEnd = Calc.GeorefCalc.CalcUnprojectedPoint(seg.endPoint, true, null); - var revitPntEnd = Revit_Build.GetRevPt(unprojectedPntEnd); + var unprojectedPntEnd = GetUnprojectedPoint(seg.endPoint); + var revitPntEnd = GetRevitPt(unprojectedPntEnd); revitSegmentCurves.Add(Line.CreateBound(revitPntStart, revitPntEnd)); } @@ -499,14 +498,14 @@ private List createModelCurveFromSegments(List segments, { if (seg.isCurve) { - var unprojectedPntStart = CityBIM.Calc.GeorefCalc.CalcUnprojectedPoint(seg.startPoint, true, null); - var revitPntStart = Revit_Build.GetRevPt(unprojectedPntStart); + var unprojectedPntStart = GetUnprojectedPoint(seg.startPoint); + var revitPntStart = GetRevitPt(unprojectedPntStart); - var unprojectedPntEnd = CityBIM.Calc.GeorefCalc.CalcUnprojectedPoint(seg.endPoint, true, null); - var revitPntEnd = Revit_Build.GetRevPt(unprojectedPntEnd); + var unprojectedPntEnd = GetUnprojectedPoint(seg.endPoint); + var revitPntEnd = GetRevitPt(unprojectedPntEnd); - var unprojectedPntMid = CityBIM.Calc.GeorefCalc.CalcUnprojectedPoint(seg.midPoint, true, null); - var revitPntMid = Revit_Build.GetRevPt(unprojectedPntMid); + var unprojectedPntMid = GetUnprojectedPoint(seg.midPoint); + var revitPntMid = GetRevitPt(unprojectedPntMid); XYZ upDirection = new XYZ(0.0, 0.0, 1.0); @@ -534,11 +533,11 @@ private List createModelCurveFromSegments(List segments, } else { - var unprojectedPntStart = CityBIM.Calc.GeorefCalc.CalcUnprojectedPoint(seg.startPoint, true, null); - var revitPntStart = Revit_Build.GetRevPt(unprojectedPntStart); + var unprojectedPntStart = GetUnprojectedPoint(seg.startPoint); + var revitPntStart = GetRevitPt(unprojectedPntStart); - var unprojectedPntEnd = CityBIM.Calc.GeorefCalc.CalcUnprojectedPoint(seg.endPoint, true, null); - var revitPntEnd = Revit_Build.GetRevPt(unprojectedPntEnd); + var unprojectedPntEnd = GetUnprojectedPoint(seg.endPoint); + var revitPntEnd = GetRevitPt(unprojectedPntEnd); XYZ upDirection = new XYZ(0.0, 0.0, 1.0); @@ -571,14 +570,14 @@ private List createModelCurveFromSegments(List segments, { if (seg.isCurve) { - var unprojectedPntStart = CityBIM.Calc.GeorefCalc.CalcUnprojectedPoint(seg.startPoint, true, null); - var revitPntStart = Revit_Build.GetRevPt(unprojectedPntStart); + var unprojectedPntStart = GetUnprojectedPoint(seg.startPoint); + var revitPntStart = GetRevitPt(unprojectedPntStart); - var unprojectedPntEnd = CityBIM.Calc.GeorefCalc.CalcUnprojectedPoint(seg.endPoint, true, null); - var revitPntEnd = Revit_Build.GetRevPt(unprojectedPntEnd); + var unprojectedPntEnd = GetUnprojectedPoint(seg.endPoint); + var revitPntEnd = GetRevitPt(unprojectedPntEnd); - var unprojectedPntMid = CityBIM.Calc.GeorefCalc.CalcUnprojectedPoint(seg.midPoint, true, null); - var revitPntMid = Revit_Build.GetRevPt(unprojectedPntMid); + var unprojectedPntMid = GetUnprojectedPoint(seg.midPoint); + var revitPntMid = GetRevitPt(unprojectedPntMid); Arc result = Arc.Create(revitPntStart, revitPntEnd, revitPntMid); @@ -590,11 +589,11 @@ private List createModelCurveFromSegments(List segments, } else { - var unprojectedPntStart = CityBIM.Calc.GeorefCalc.CalcUnprojectedPoint(seg.startPoint, true, null); - var revitPntStart = Revit_Build.GetRevPt(unprojectedPntStart); + var unprojectedPntStart = GetUnprojectedPoint(seg.startPoint); + var revitPntStart = GetRevitPt(unprojectedPntStart); - var unprojectedPntEnd = CityBIM.Calc.GeorefCalc.CalcUnprojectedPoint(seg.endPoint, true, null); - var revitPntEnd = Revit_Build.GetRevPt(unprojectedPntEnd); + var unprojectedPntEnd = GetUnprojectedPoint(seg.endPoint); + var revitPntEnd = GetRevitPt(unprojectedPntEnd); Line result = Line.CreateBound(revitPntStart, revitPntEnd); diff --git a/CityBIM/Builder/RevitBuilder.cs b/CityBIM/Builder/RevitBuilder.cs new file mode 100644 index 00000000..cf4ee7f0 --- /dev/null +++ b/CityBIM/Builder/RevitBuilder.cs @@ -0,0 +1,150 @@ +using Autodesk.Revit.DB; +using BIMGISInteropLibs.Geometry; +using CityBIM.GUI; +using Microsoft.Isam.Esent.Interop; +using System.Collections.Generic; + +namespace CityBIM.Builder +{ + public class RevitBuilder + { + public Document doc { get; protected set; } + private readonly XYZ pbp; + private C2BPoint pbp_c2b { get => new C2BPoint(pbp.X, pbp.Y, pbp.Z); } + private readonly double projectScale; + public Autodesk.Revit.DB.Transform trafo2RevitCS { get; protected set; } + + public RevitBuilder(Document doc) + { + this.doc = doc; + this.pbp = utils.getProjectBasePointMeter(doc); + this.projectScale = utils.getHTWDDProjectScale(doc); + this.trafo2RevitCS = utils.getGlobalToRevitTransform(this.doc); + } + + public XYZ GetUnProjectedPoint(XYZ geoPnt, XYZ offset = null) + { + if (offset != null) + { + geoPnt = geoPnt + offset; + } + + var geoPntUnProjX = geoPnt.X - (geoPnt.X - this.pbp.X) + (geoPnt.X - this.pbp.X) / this.projectScale; + var geoPntUnProjY = geoPnt.Y - (geoPnt.Y - this.pbp.Y) + (geoPnt.Y - this.pbp.Y) / this.projectScale; + + return new XYZ(geoPntUnProjX, geoPntUnProjY, geoPnt.Z); + } + + public C2BPoint GetUnprojectedPoint(C2BPoint geoPnt, C2BPoint offset = null) + { + if (offset != null) + { + geoPnt = geoPnt + offset; + } + + var geoPntUnProjX = geoPnt.X - (geoPnt.X - pbp.X) + (geoPnt.X - pbp.X) / projectScale; + var geoPntUnProjY = geoPnt.Y - (geoPnt.Y - pbp.Y) + (geoPnt.Y - pbp.Y) / projectScale; + + return new C2BPoint(geoPntUnProjX, geoPntUnProjY, geoPnt.Z); + } + + public XYZ GetRevitPt(XYZ point) + { + var pnt_feet = point.Divide(0.3048); + return this.trafo2RevitCS.OfPoint(pnt_feet); + } + + public XYZ GetRevitPt(C2BPoint point) + { + var pnt_feet = new XYZ(point.X, point.Y, point.Z).Divide(0.3048); + return this.trafo2RevitCS.OfPoint(pnt_feet); + } + + /// + /// Creates List of CurveLoops with exterior ring and may interior rings + /// + /// List of CurveLoops for Revit geometry builder e.g. extrusion profile + public List CreateExteriorCurveLoopList(List exteriorRing, List> interiorRings, out XYZ planeNormal, C2BPoint calcOffset = null) + { + List rvtPoly = new List(); //return variable --> extrusion profile (1 x exterior ring, n x interior rings) + + planeNormal = CalcExteriorFace(exteriorRing/*, interiorRings*/, out List extPlane/*, out List> intPlaneLi*/); //calculation of normal pointing + + //map to revit and reverse calculation of projection - exterior + + List rvtExteriorXYZ = new List(); + + foreach (var pt in extPlane) + { + C2BPoint unprojectedPt = GetUnprojectedPoint(pt, calcOffset); + XYZ revPt = GetRevitPt(unprojectedPt); //transform to Revit Pt + + rvtExteriorXYZ.Add(revPt); + } + + //create CurveLoops - exterior + + List edgesExt = new List(); + + for (var c = 1; c < rvtExteriorXYZ.Count; c++) + { + Line edgeEx = Line.CreateBound(rvtExteriorXYZ[c - 1], rvtExteriorXYZ[c]); + + edgesExt.Add(edgeEx); + } + + CurveLoop outerLoop = CurveLoop.Create(edgesExt); + rvtPoly.Add(outerLoop); + + return rvtPoly; + } + + + /// + /// Calculates a plane representation of the polygon + /// + /// exteriorRing + /// interiorRings + /// equalizedNormal + private static XYZ CalcExteriorFace(List extPts, out List extPtsPl) + { + extPtsPl = new List(); + //intPtsLPl = new List>(); + + //plane polygon needs one normal (balanced out of all segments) for further calculations + + C2BPoint centroidExt = new C2BPoint(0, 0, 0); //needed later, but can be calculated in first loop + + //Normal calculation + //------------------ + + C2BPoint normalVc = new C2BPoint(0, 0, 0); + + for (var c = 1; c < extPts.Count; c++) + { + normalVc += C2BPoint.CrossProduct(extPts[c - 1], extPts[c]); + + centroidExt += extPts[c]; + } + + C2BPoint normalizedVc = C2BPoint.Normalized(normalVc); + C2BPoint normalizedVcCW = new C2BPoint(-normalizedVc.X, -normalizedVc.Y, -normalizedVc.Z); + + //Improvements of points (matches the new balanced plane) + //------------------ + + C2BPoint centroidExtR = centroidExt / (extPts.Count - 1); + + foreach (var pt in extPts) + { + C2BPoint vecPtCent = pt - centroidExtR; + double d = C2BPoint.ScalarProduct(vecPtCent, normalizedVc); + + C2BPoint vecLotCent = new C2BPoint(d * normalizedVc.X, d * normalizedVc.Y, d * normalizedVc.Z); + extPtsPl.Add(pt - vecLotCent); + } + + return new XYZ(normalizedVc.X, normalizedVc.Y, normalizedVc.Z); + } + } +} diff --git a/CityBIM/Builder/RevitTopoSurfaceBuilder.cs b/CityBIM/Builder/RevitTopoSurfaceBuilder.cs index 66534566..9c84dcf5 100644 --- a/CityBIM/Builder/RevitTopoSurfaceBuilder.cs +++ b/CityBIM/Builder/RevitTopoSurfaceBuilder.cs @@ -13,9 +13,8 @@ namespace CityBIM.Builder { - internal class RevitTopoSurfaceBuilder + internal class RevitTopoSurfaceBuilder : RevitBuilder { - private readonly Document doc; /// /// return this value for error handling of import @@ -27,9 +26,9 @@ internal class RevitTopoSurfaceBuilder /// private bool importSuccesful { set; get; } = false; - public RevitTopoSurfaceBuilder(Document doc) + public RevitTopoSurfaceBuilder(Document doc) : base(doc) { - this.doc = doc; + } /// @@ -201,10 +200,10 @@ private List transPts(List terrainPoints) C2BPoint c2bPoint = new C2BPoint(pt.X, pt.Y, pt.Z); //Transformation for revit - var unprojectedPt = Calc.GeorefCalc.CalcUnprojectedPoint(c2bPoint, true); + var unprojectedPt = GetUnprojectedPoint(c2bPoint); //add to new list (as projected point) - revDTMpts.Add(Revit_Build.GetRevPt(unprojectedPt)); + revDTMpts.Add(GetRevitPt(unprojectedPt)); } return revDTMpts; @@ -222,9 +221,9 @@ private List transCoords(List coordinateList) foreach (var coord in coordinateList) { C2BPoint c2bpoint = new C2BPoint(coord.X, coord.Y, coord.Z); - var unprojectedPt = Calc.GeorefCalc.CalcUnprojectedPoint(c2bpoint, true); + var unprojectedPt = GetUnprojectedPoint(c2bpoint); - revDTMpts.Add(Revit_Build.GetRevPt(unprojectedPt)); + revDTMpts.Add(GetRevitPt(unprojectedPt)); } return revDTMpts; } diff --git a/CityBIM/Builder/Revit_Build.cs b/CityBIM/Builder/Revit_Build.cs deleted file mode 100644 index 98067797..00000000 --- a/CityBIM/Builder/Revit_Build.cs +++ /dev/null @@ -1,212 +0,0 @@ -using Autodesk.Revit.DB; -using CityBIM.GUI; -using BIMGISInteropLibs.Geometry; -using System.Collections.Generic; - -namespace CityBIM.Builder -{ - public static class Revit_Build - { - /// - /// Creates List of CurveLoops with exterior ring and may interior rings - /// - /// List of CurveLoops for Revit geometry builder e.g. extrusion profile - public static List CreateExteriorCurveLoopList(List exteriorRing, List> interiorRings, out XYZ planeNormal, C2BPoint calcOffset = null) - { - List rvtPoly = new List(); //return variable --> extrusion profile (1 x exterior ring, n x interior rings) - - planeNormal = CalcExteriorFace(exteriorRing/*, interiorRings*/, out List extPlane/*, out List> intPlaneLi*/); //calculation of normal pointing - - //map to revit and reverse calculation of projection - exterior - - List rvtExteriorXYZ = new List(); - - foreach (var pt in extPlane) - { - C2BPoint unprojectedPt = Calc.GeorefCalc.CalcUnprojectedPoint(pt, Prop_CityGML_settings.IsGeodeticSystem, calcOffset); //calc unprojected coords - XYZ revPt = GetRevPt(unprojectedPt); //transform to Revit Pt - - rvtExteriorXYZ.Add(revPt); - } - - //create CurveLoops - exterior - - List edgesExt = new List(); - - for (var c = 1; c < rvtExteriorXYZ.Count; c++) - { - Line edgeEx = Line.CreateBound(rvtExteriorXYZ[c - 1], rvtExteriorXYZ[c]); - - edgesExt.Add(edgeEx); - } - - CurveLoop outerLoop = CurveLoop.Create(edgesExt); - rvtPoly.Add(outerLoop); - - return rvtPoly; - } - - public static List CreateInteriorCurveLoopList(/*List exteriorRing,*/ List> interiorRings, out XYZ planeNormal, C2BPoint calcOffset = null) - { - List rvtPoly = new List(); //return variable --> extrusion profile (1 x exterior ring, n x interior rings) - - planeNormal = CalcInteriorFace(interiorRings, out List> intPlaneLi); //calculation of normal pointing - - //map to revit and reverse calculation of projection - interior - - List> rvtInteriorXYZList = new List>(); - - foreach (var ring in intPlaneLi) - { - List rvtInteriorXYZ = new List(); - - foreach (var pt in ring) - { - C2BPoint unprojectedPt = Calc.GeorefCalc.CalcUnprojectedPoint(pt, Prop_CityGML_settings.IsGeodeticSystem, calcOffset); //calc unprojected coords - XYZ revPt = GetRevPt(unprojectedPt); //transform to Revit Pt - - rvtInteriorXYZ.Add(revPt); - } - rvtInteriorXYZList.Add(rvtInteriorXYZ); - } - - //create CurveLoops - interior - foreach (var rvtInteriorXYZ in rvtInteriorXYZList) - { - List edgesInt = new List(); - - for (var c = 1; c < rvtInteriorXYZ.Count; c++) - { - Line edgeIn = Line.CreateBound(rvtInteriorXYZ[c - 1], rvtInteriorXYZ[c]); - - edgesInt.Add(edgeIn); - } - - CurveLoop innerLoop = CurveLoop.Create(edgesInt); - rvtPoly.Add(innerLoop); - } - return rvtPoly; - } - - /// - /// Calculates a plane representation of the polygon - /// - /// exteriorRing - /// interiorRings - /// equalizedNormal - private static XYZ CalcExteriorFace(List extPts, out List extPtsPl) - { - extPtsPl = new List(); - //intPtsLPl = new List>(); - - //plane polygon needs one normal (balanced out of all segments) for further calculations - - C2BPoint centroidExt = new C2BPoint(0, 0, 0); //needed later, but can be calculated in first loop - - //Normal calculation - //------------------ - - C2BPoint normalVc = new C2BPoint(0, 0, 0); - - for (var c = 1; c < extPts.Count; c++) - { - normalVc += C2BPoint.CrossProduct(extPts[c - 1], extPts[c]); - - centroidExt += extPts[c]; - } - - C2BPoint normalizedVc = C2BPoint.Normalized(normalVc); - C2BPoint normalizedVcCW = new C2BPoint(-normalizedVc.X, -normalizedVc.Y, -normalizedVc.Z); - - //Improvements of points (matches the new balanced plane) - //------------------ - - C2BPoint centroidExtR = centroidExt / (extPts.Count - 1); - - foreach (var pt in extPts) - { - C2BPoint vecPtCent = pt - centroidExtR; - double d = C2BPoint.ScalarProduct(vecPtCent, normalizedVc); - - C2BPoint vecLotCent = new C2BPoint(d * normalizedVc.X, d * normalizedVc.Y, d * normalizedVc.Z); - extPtsPl.Add(pt - vecLotCent); - } - - return new XYZ(normalizedVc.X, normalizedVc.Y, normalizedVc.Z); - } - - private static XYZ CalcInteriorFace(List> intPtsL, /*out List extPtsPl,*/ out List> intPtsLPl) - { - intPtsLPl = new List>(); - - //plane polygon needs one normal (balanced out of all segments) for further calculations - - C2BPoint centroidExt = new C2BPoint(0, 0, 0); //needed later, but can be calculated in first loop - - //Normal calculation - //------------------ - - C2BPoint normalVc = new C2BPoint(0, 0, 0); - - //interior points for normal (not for centroid) - foreach (var intPts in intPtsL) - { - for (var c = 1; c < intPts.Count; c++) - { - var intNormalVc = C2BPoint.CrossProduct(intPts[c - 1], intPts[c]); - - normalVc += new C2BPoint(-intNormalVc.X, -intNormalVc.Y, -intNormalVc.Z); //turn sign because interior polygon is CW - } - } - - C2BPoint normalizedVc = C2BPoint.Normalized(normalVc); - C2BPoint normalizedVcCW = new C2BPoint(-normalizedVc.X, -normalizedVc.Y, -normalizedVc.Z); - - foreach (var intPts in intPtsL) - { - List planarIntPts = new List(); - C2BPoint centroidIntPl = new C2BPoint(0, 0, 0); - - //at first calculate centroid for interior ring - - for (var c = 1; c < intPts.Count; c++) - { - centroidIntPl += intPts[c]; - } - - C2BPoint centroidI = centroidIntPl / (intPts.Count - 1); - - foreach (var pt in intPts) - { - C2BPoint vecPtCent = pt - centroidI; - double d = C2BPoint.ScalarProduct(vecPtCent, normalizedVcCW); - - C2BPoint vecLotCent = new C2BPoint(d * normalizedVcCW.X, d * normalizedVcCW.Y, d * normalizedVcCW.Z); - planarIntPts.Add(pt - vecLotCent); - } - - intPtsLPl.Add(planarIntPts); - } - - return new XYZ(normalizedVc.X, normalizedVc.Y, normalizedVc.Z); - } - - /// - /// Calculates point for the needs of Revit DB (feet, PBPtrafo) - /// - /// internal Pt - /// Revit XYZ pt - public static XYZ GetRevPt(C2BPoint xmlPt) - { - var revitPt = xmlPt / Prop_Revit.feetToM; - - //Creation of Revit point - var revitXYZ = new XYZ(revitPt.Y, revitPt.X, revitPt.Z); - - //Transform global coordinate to Revit project coordinate system (system of project base point) - var revTransXYZ = Prop_Revit.TrafoPBP.OfPoint(revitXYZ); - - return revTransXYZ; - } - } -} diff --git a/CityBIM/Builder/XPlanBuilder.cs b/CityBIM/Builder/XPlanBuilder.cs deleted file mode 100644 index 31453107..00000000 --- a/CityBIM/Builder/XPlanBuilder.cs +++ /dev/null @@ -1,169 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -using Autodesk.Revit.DB; -using Autodesk.Revit.DB.Architecture; -using Autodesk.Revit.DB.ExtensibleStorage; -using Autodesk.Revit.DB.Fabrication; -using Autodesk.Revit.UI; - -using BIMGISInteropLibs.Alkis; -using BIMGISInteropLibs.Geometry; -using BIMGISInteropLibs.Semantic; -using BIMGISInteropLibs.XPlanung; -using CityBIM.Calc; -using CityBIM; - -namespace CityBIM.Builder -{ - public class XPlanBuilder - { - //ExternalCommandData commandData; - private readonly Document doc; - //private readonly Dictionary colors; - //private ElementId terrainID; - - public XPlanBuilder(Document doc) //, ExternalCommandData cData) - { - //commandData = cData; - this.doc = doc; - //this.colors = CreateColorAsMaterial(); - ElementId terrainID = Prop_Revit.TerrainId; - //terrainID = Prop_Revit.TerrainId; - } - - public void buildRevitObjects(List xPlanungList, bool drapeOnTerrain) - { - var queryGroups = from xObj in xPlanungList - group xObj by xObj.UsageType into usageGroup - select usageGroup; - - ElementId terrainID = utils.getHTWDDTerrainID(doc); - - foreach(var group in queryGroups) - { - ElementId RefPlaneId = (terrainID == null) ? null : terrainID; - //ElementId terrainID = null; - string groupName = group.Key; - List objList = group.ToList(); - - var refSurfPts = createRefSurfacePointsForObjGroup(objList); - List reducedPoints = refSurfPts.Select(p => GeorefCalc.CalcUnprojectedPoint(p, true)).ToList(); - List RevitPts = reducedPoints.Select(p => Revit_Build.GetRevPt(p)).ToList(); - - //When no DTM is availabe -> xPlanungObjects are mapped flat - if (RefPlaneId == null || drapeOnTerrain == false ) - { - using (Transaction trans = new Transaction(doc, "Create RefPlane")) - { - trans.Start(); - TopographySurface refSurf = TopographySurface.Create(doc, RevitPts); - refSurf.Pinned = true; - - Parameter nameParam = refSurf.LookupParameter("Name"); - nameParam.Set("RefPlane_" + groupName); - - RefPlaneId = refSurf.Id; - trans.Commit(); - } - } - - //When xPlanungsObjects should be mapped to DTM data - else - { - using (Transaction trans = new Transaction(doc, "Copy DTM as new RefPlane")) - { - trans.Start(); - TopographySurface refSurf = doc.GetElement(RefPlaneId) as TopographySurface; - var copyOfRefSurfId = ElementTransformUtils.CopyElement(doc, refSurf.Id, new XYZ(0, 0, 0)); - - TopographySurface copiedRefSurf = doc.GetElement(copyOfRefSurfId.First()) as TopographySurface; - copiedRefSurf.Pinned = true; - - Parameter nameParam = copiedRefSurf.LookupParameter("Name"); - nameParam.Set("RefPlane_" + groupName); - - RefPlaneId = copiedRefSurf.Id; - trans.Commit(); - } - } - - Schema currentSchema = utils.getSchemaByName(groupName); - - if (objList[0].Geom == XPlanungObject.geomType.Polygon) - { - using (Transaction trans = new Transaction(doc, "Create XPlanObjs")) - { - trans.Start(); - foreach (var xObj in objList) - { - var siteSubRegion = createSiteSubRegion(xObj, RefPlaneId); - - Parameter nameParam = siteSubRegion.TopographySurface.LookupParameter("Name"); - //nameParam.Set("RefPlane_" + groupName); - nameParam.Set(groupName); - - //Add Attributes - Entity ent = new Entity(currentSchema); - var fieldList = currentSchema.ListFields(); - var fieldNameList = new List(); - - foreach (var field in fieldList) - { - fieldNameList.Add(field.FieldName); - } - - Field gmlid = currentSchema.GetField("gmlid"); - ent.Set(gmlid, xObj.Gmlid); - - foreach (KeyValuePair entry in xObj.Attributes) - { - if (fieldNameList.Contains(entry.Key)) - { - Field currentField = currentSchema.GetField(entry.Key); - ent.Set(currentField, entry.Value); - } - } - TopographySurface topoSurface = siteSubRegion.TopographySurface; - topoSurface.SetEntity(ent); - } - trans.Commit(); - } - } - } - } - - private SiteSubRegion createSiteSubRegion(XPlanungObject obj, ElementId hostId) - { - List polyExt = obj.getOuterRing(); - List> polysInt = obj.getInnerRings(); - - List loopList = Revit_Build.CreateExteriorCurveLoopList(polyExt, polysInt, out XYZ normal); - SiteSubRegion siteSubRegion = SiteSubRegion.Create(doc, loopList, hostId); - return siteSubRegion; - } - - private static List createRefSurfacePointsForObjGroup(List objList) - { - List pointList = new List(); - foreach(var xplanObj in objList) - { - foreach (var segment in xplanObj.Segments) - { - foreach (var point in segment) - { - pointList.Add(point); - } - } - } - - var ptList = pointList.ConvertAll(p => new Calc.Point(p.X, p.Y)); - var convexHull = Calc.ConvexHull.MakeHull(ptList); - - var C2BPtList = convexHull.Select(p => new C2BPoint(p.x, p.y, 0)); - - return C2BPtList.ToList(); - } - } -} diff --git a/CityBIM/Calc/GeorefCalc.cs b/CityBIM/Calc/GeorefCalc.cs deleted file mode 100644 index 7893e0dd..00000000 --- a/CityBIM/Calc/GeorefCalc.cs +++ /dev/null @@ -1,47 +0,0 @@ -using BIMGISInteropLibs.Geometry; -using CityBIM.GUI; - -namespace CityBIM.Calc -{ - public static class GeorefCalc - { - /// - /// Calculates unscaled Point out of Scale and adds global coordinate offset (if specified before) - /// - /// point coordinate (local, if global offset specified) - /// coordinate order of input (t=YXZ, f=XYZ) - /// global coordinate offset if specified for mathematical calculations - /// Unprojected (scale = 1.0) point for CAD/BIM representation - public static C2BPoint CalcUnprojectedPoint(C2BPoint localPt, bool isGeodetic, C2BPoint globalPt = null) - { - if (globalPt == null) - globalPt = new C2BPoint(0, 0, 0); - - //At first add lowerCorner from gml - double xGlobalProj = localPt.X + globalPt.X; - double yGlobalProj = localPt.Y + globalPt.Y; - - var deltaX = xGlobalProj - Prop_GeoRefSettings.ProjCoord[1]; - var deltaY = yGlobalProj - Prop_GeoRefSettings.ProjCoord[0]; - - if (isGeodetic) - { - xGlobalProj = localPt.Y + globalPt.Y; - yGlobalProj = localPt.X + globalPt.X; - - deltaX = xGlobalProj - Prop_GeoRefSettings.ProjCoord[0]; - deltaY = yGlobalProj - Prop_GeoRefSettings.ProjCoord[1]; - } - - var deltaXUnproj = deltaX / Prop_GeoRefSettings.ProjScale; - var deltaYUnproj = deltaY / Prop_GeoRefSettings.ProjScale; - - var xGlobalUnproj = xGlobalProj - deltaX + deltaXUnproj; - var yGlobalUnproj = yGlobalProj - deltaY + deltaYUnproj; - - var zGlobal = localPt.Z + globalPt.Z; - - return new C2BPoint(xGlobalUnproj, yGlobalUnproj, zGlobal); - } - } -} diff --git a/CityBIM/Calc/Transformation.cs b/CityBIM/Calc/Transformation.cs deleted file mode 100644 index dddc57e6..00000000 --- a/CityBIM/Calc/Transformation.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; - -using Autodesk.Revit.DB; - - -namespace CityBIM.Calc -{ - class Transformation - { - double feetToMeter = 1.0 / 0.3048; - - /// - /// Transforms local coordinates to relative coordinates due to the fact that revit has a 20 miles limit for presentation of geometry. - /// - /// - /// - public Transform transform(Document doc) - { - //Zuerst wird die Position des Projektbasispunkts bestimmt - ProjectLocation projloc = doc.ActiveProjectLocation; - ProjectPosition position_data = projloc.GetProjectPosition(XYZ.Zero); - double angle = position_data.Angle; - double elevation = position_data.Elevation; - double easting = position_data.EastWest; - double northing = position_data.NorthSouth; - - // Der Ostwert des PBB wird als mittlerer Ostwert für die UTM Reduktion verwendet. - double xSchwPktFt = easting; - double xSchwPktKm = (double)((xSchwPktFt / feetToMeter) / 1000); - double xSchwPkt500 = xSchwPktKm - 500; - double R = 1; - - Transform trot = Transform.CreateRotation(XYZ.BasisZ, -angle); - XYZ vector = new XYZ(easting, northing, elevation); - XYZ vectorRedu = vector / R; - Transform ttrans = Transform.CreateTranslation(-vectorRedu); - Transform transf = trot.Multiply(ttrans); - - return transf; - } - - public Plane getGeomPlane(XYZ normal, XYZ origin) - { - Plane geomPlane = Plane.CreateByNormalAndOrigin(normal, origin); - return geomPlane; - } - - public XYZ getProjectBasePoint(Document doc) - { - ProjectLocation projloc = doc.ActiveProjectLocation; - ProjectPosition position_data = projloc.GetProjectPosition(XYZ.Zero); - double elevation = position_data.Elevation; - double easting = position_data.EastWest; - double northing = position_data.NorthSouth; - - XYZ pbp = new XYZ(Math.Round((easting / feetToMeter), 4), (Math.Round((northing / feetToMeter), 4)), (Math.Round((elevation / feetToMeter), 4))); - - return pbp; - } - - public Double getAngle(Document doc) - { - ProjectLocation projloc = doc.ActiveProjectLocation; - ProjectPosition position_data = projloc.GetProjectPosition(XYZ.Zero); - double angle = position_data.Angle; - - return angle; - } - } -} diff --git a/CityBIM/Calc/UTMcalc.cs b/CityBIM/Calc/UTMcalc.cs index 4a98488d..a223e0cd 100644 --- a/CityBIM/Calc/UTMcalc.cs +++ b/CityBIM/Calc/UTMcalc.cs @@ -3,9 +3,6 @@ using System.IO; using System.Reflection; -using GeographicLib; -using GeographicLib.Projections; - namespace CityBIM.Calc { public static class UTMcalc @@ -14,14 +11,8 @@ public static class UTMcalc public static readonly double UtmFalseEasting = 500000.0; public static readonly double UtmFalseNorthing = 10000000.0; - public static readonly Ellipsoid Grs80 = new Ellipsoid(GeographicLib.Constants.GRS80_a, 1/298.257222101); - - private static readonly TransverseMercator utmGrs80 = new TransverseMercator(Grs80.EquatorialRadius, Grs80.Flattening, UtmScale); - private static readonly string egm2008Path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location).Replace("\\", "/"); - private static readonly GravityModel egm2008 = new GravityModel("egm2008", egm2008Path); - public static readonly double Rho = 180.0 / Math.PI; public static readonly double RevRho = Math.PI / 180.0; @@ -140,26 +131,6 @@ public static string DoubleToString(double value, int dec) return value.ToString(fmt, CultureInfo.InvariantCulture); } - public static void UtmGrs80Forward(int zone, double lat, double lon, out double easting, out double northing, out double gamma, out double scale, out bool isSouth) - { - var lon0 = ZoneToLon0(zone); - (easting, northing) = utmGrs80.Forward(lon0, lat, lon, out gamma, out scale); - - easting += UtmFalseEasting; - isSouth = false; - if(northing < 0.0) - { - northing += UtmFalseNorthing; - isSouth = true; - } - } - - public static void UtmGrs80Reverse(int zone, bool isSouth, double easting, double northing, out double lat, out double lon, out double gamma, out double scale) - { - var lon0 = ZoneToLon0(zone); - (lat, lon) = utmGrs80.Reverse(lon0, easting - UtmFalseEasting, isSouth ? northing - UtmFalseNorthing : northing, out gamma, out scale); - } - public static long[] SplitSexagesimal(string geographyDegree) { long deg = long.Parse(geographyDegree.Substring(0, geographyDegree.IndexOf('°'))); @@ -175,46 +146,5 @@ public static long[] SplitSexagesimal(string geographyDegree) return geograpgyDegreeSplit; } - - public static double GeoidHeight(double lat, double lon) => egm2008.GeoidHeight(lat, lon); - - public static double GaussianRadiusOfCurvature(double lat) - { - var sin = Math.Sin(DegToRad(lat)); - return Grs80.PolarRadius / (1.0 - (Grs80.EccentricitySq * sin * sin)); - } - - public static void GetGeoRef(bool isPosGeo, ref double lat, ref double lon, ref int? zone, ref double east, ref double north, ref bool isSouth, - double orthoHeight, bool isRotGeo, ref double geoAzi, ref double gridAzi, out double combinedScale) - { - double convergence, projScale; - if(isPosGeo) - { - zone = zone ?? LonToZone(lon); - UtmGrs80Forward(zone.Value, lat, lon, out east, out north, out convergence, out projScale, out isSouth); - } - else - { - zone = zone ?? int.MaxValue; - UtmGrs80Reverse(zone.Value, isSouth, east, north, out lat, out lon, out convergence, out projScale); - } - - var radius = GaussianRadiusOfCurvature(lat); - var geoidHeight = GeoidHeight(lat, lon); - var heightScale = radius / (radius + orthoHeight + geoidHeight); - - combinedScale = projScale * heightScale; - - if(isRotGeo) - { - geoAzi = AzimuthToRange(geoAzi); - gridAzi = AzimuthToRange(geoAzi - convergence); - } - else - { - gridAzi = AzimuthToRange(gridAzi); - geoAzi = AzimuthToRange(gridAzi + convergence); - } - } } } \ No newline at end of file diff --git a/CityBIM/CityBIM.csproj b/CityBIM/CityBIM.csproj index 53f5bfd4..11cbbed9 100644 --- a/CityBIM/CityBIM.csproj +++ b/CityBIM/CityBIM.csproj @@ -6,6 +6,7 @@ CityBIM Copyright © 2019 7.1 + true full @@ -36,7 +37,6 @@ - @@ -49,13 +49,10 @@ - - - @@ -102,77 +99,6 @@ - - - CityGML_ImportUI.xaml - - - Terrain_ImportUI.xaml - - - IfcExportDialog.xaml - - - LayerSelector.xaml - - - ImportDialogAlkis.xaml - - - PropertyWindow.xaml - - - ImportXPlanDialog.xaml - - - Localization.resx - True - True - - - Wpf_GeoRef_Form.xaml - - - True - True - ResourcePictures.resx - PreserveNewest - - - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - PreserveNewest @@ -185,10 +111,6 @@ - - PublicResXFileCodeGenerator - Localization.Designer.cs - @@ -210,14 +132,6 @@ PreserveNewest - - - PreserveNewest - - - PreserveNewest - - PublicResXFileCodeGenerator @@ -234,6 +148,7 @@ + diff --git a/CityBIM/GUI/City2BIM/CityGML_ImportUI.xaml b/CityBIM/GUI/City2BIM/CityGML_ImportUI.xaml index 890d9ee3..57604c1d 100644 --- a/CityBIM/GUI/City2BIM/CityGML_ImportUI.xaml +++ b/CityBIM/GUI/City2BIM/CityGML_ImportUI.xaml @@ -5,27 +5,21 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:CityBIM.GUI.City2BIM" mc:Ignorable="d" - d:DesignHeight="450" d:DesignWidth="800" Title="Import CityGML Data" - Height="450" Width="800" MinHeight="450" MinWidth="800"> + d:DesignHeight="250" d:DesignWidth="800" Title="Import CityGML Data" + Height="250" Width="800" MinWidth="800" SizeToContent="Height"> - - - - + + + - - - File - Server - - + - + @@ -37,76 +31,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -133,9 +62,9 @@ - + - + diff --git a/CityBIM/GUI/City2BIM/CityGML_ImportUI.xaml.cs b/CityBIM/GUI/City2BIM/CityGML_ImportUI.xaml.cs index a5885532..31268d7d 100644 --- a/CityBIM/GUI/City2BIM/CityGML_ImportUI.xaml.cs +++ b/CityBIM/GUI/City2BIM/CityGML_ImportUI.xaml.cs @@ -39,31 +39,11 @@ public CityGML_ImportUI() { InitializeComponent(); CityGML_ImportUI_Loaded(); - - Lat_Box.Text = CityBIM.GUI.Prop_GeoRefSettings.WgsCoord[0].ToString(); - Long_Box.Text = CityBIM.GUI.Prop_GeoRefSettings.WgsCoord[1].ToString(); } private void CityGML_ImportUI_Loaded() { - srcFile.IsChecked = true; - siteLocation.IsChecked = true; - } - - private void src_Checked(object sender, RoutedEventArgs e) - { - RadioButton rb = sender as RadioButton; - - if (rb.Name.Equals("srcFile")) - { - gB_File.IsEnabled = true; - gB_Server.IsEnabled = false; - } - else - { - gB_File.IsEnabled = false; - gB_Server.IsEnabled = true; - } + } private void cancelBtn_click(object sender, RoutedEventArgs e) @@ -84,54 +64,12 @@ private void fileBrowse_Btn_Click(object sender, RoutedEventArgs e) } } - private void responseFolder_Btn_Click(object sender, RoutedEventArgs e) - { - var folderDialog = new System.Windows.Forms.FolderBrowserDialog(); - folderDialog.ShowNewFolderButton = true; - folderDialog.ShowDialog(); - ResponsePath.Text = folderDialog.SelectedPath; - - } - - private void editURL_click(object sender, RoutedEventArgs e) - { - serverURL_Box.IsReadOnly = false; - } - - private void center_checked(object sender, RoutedEventArgs e) - { - RadioButton rb = sender as RadioButton; - - if (rb.Name.Equals("siteLocation")) - { - Lat_Box.Text = CityBIM.GUI.Prop_GeoRefSettings.WgsCoord[0].ToString(); - Long_Box.Text = CityBIM.GUI.Prop_GeoRefSettings.WgsCoord[1].ToString(); - Lat_Box.IsReadOnly = true; - Long_Box.IsReadOnly = true; - } - else - { - Lat_Box.IsReadOnly = false; - Long_Box.IsReadOnly = false; - } - } - private void import_Btn_Click(object sender, RoutedEventArgs e) { CityBIM.Builder.CoordOrder co = CityBIM.Builder.CoordOrder.ENH; - if (NEHOrder_Radio.IsChecked == true) - { - co = CityBIM.Builder.CoordOrder.NEH; - } - CityBIM.Builder.CitySource cs = CityBIM.Builder.CitySource.File; - if (srcServer.IsChecked == true) - { - cs = CityBIM.Builder.CitySource.Server; - } - BIMGISInteropLibs.CityGML.CityGml_Codelist.Codelist cl; if (codelist_check.IsChecked == true) @@ -179,22 +117,16 @@ private void import_Btn_Click(object sender, RoutedEventArgs e) } bool saveServerResponse = false; - if (response_Box.IsChecked == true) - { - saveServerResponse = true; - } - + var importSettings = new CityBIM.Builder.CityGMLImportSettings(); importSettings.CoordOrder = co; importSettings.ImportSource = cs; importSettings.CodeTranslate = cl; importSettings.FilePath = filePath_Box.Text; importSettings.ImportGeomType = cg; - importSettings.serverURL = serverURL_Box.Text; - importSettings.FolderPath = ResponsePath.Text; - importSettings.CenterCoords = new double[] { Double.Parse(Lat_Box.Text), Double.Parse(Long_Box.Text) }; + + importSettings.saveResponse = saveServerResponse; - importSettings.Extent = Double.Parse(extent_Box.Text); this.startImport = true; this.importSettings = importSettings; diff --git a/CityBIM/GUI/City2BIM/Cmd_ImportCityGML.cs b/CityBIM/GUI/City2BIM/Cmd_ImportCityGML.cs index 6cbbeb5e..5464f4fb 100644 --- a/CityBIM/GUI/City2BIM/Cmd_ImportCityGML.cs +++ b/CityBIM/GUI/City2BIM/Cmd_ImportCityGML.cs @@ -4,6 +4,7 @@ using System.Xml.Linq; using System; using System.Collections.Generic; +using System.IO; using Serilog; @@ -26,8 +27,6 @@ public Autodesk.Revit.UI.Result Execute(ExternalCommandData revit, ref string me { Document doc = revit.Application.ActiveUIDocument.Document; - Prop_GeoRefSettings.SetInitialSettings(doc); - var dialog = new CityGML_ImportUI(); dialog.ShowDialog(); @@ -44,6 +43,11 @@ public Autodesk.Revit.UI.Result Execute(ExternalCommandData revit, ref string me try { string path = importSettings.FilePath; + if (!File.Exists(path)) + { + TaskDialog.Show("Error", "Could not find a file for specified path"); + return Result.Failed; + } xdoc = XDocument.Load(path); } catch (Exception ex) @@ -54,38 +58,6 @@ public Autodesk.Revit.UI.Result Execute(ExternalCommandData revit, ref string me } break; - case CitySource.Server: - try - { - //client class for xml-POST request from WFS server - WFSClient client = new WFSClient(importSettings.serverURL); - - //response with parameters: Site-Lon, Site-Lat, extent, max response of bldgs, CRS) - //Site coordinates from Revit.SiteLocation - //extent from used-defined def (default: 300 m) - //max response dependent of server settings (at VCS), currently 500 - //CRS: supported from server are currently: Pseudo-Mercator (3857), LatLon (4326), German National Systems: West(25832), East(25833) - // supported by PlugIn are only the both German National Systems - - if (Prop_GeoRefSettings.Epsg != "EPSG:25832" && Prop_GeoRefSettings.Epsg != "EPSG:25833") - TaskDialog.Show("EPSG not supported!", "Only EPSG:25832 or EPSG:25833 will be supported by server. Please change the EPSG-Code in Georeferencing window."); - - xdoc = client.getFeaturesCircle(importSettings.CenterCoords[1], importSettings.CenterCoords[0], importSettings.Extent, 500, Prop_GeoRefSettings.Epsg); - - if (importSettings.saveResponse) - { - xdoc.Save(importSettings.FolderPath + "\\" + Math.Round(importSettings.CenterCoords[0], 4) + "_" + Math.Round(importSettings.CenterCoords[1], 4) + ".gml"); - } - } - - catch (Exception ex) - { - TaskDialog.Show("Error", "Could not process server request. See log-file for further information"); - Log.Error("Error during processing of CityGML Server Request"); - Log.Error(ex.ToString()); - } - break; - default: break; } @@ -128,7 +100,7 @@ public Autodesk.Revit.UI.Result Execute(ExternalCommandData revit, ref string me } //erstellt Revit-seitig die Geometrie und ordnet Attributwerte zu - RevitCityBuilder cityModel = new CityBIM.Builder.RevitCityBuilder(doc, gmlBuildings, lowerCorner, attributes, importSettings.CodeTranslate); + CityBuilder cityModel = new CityBuilder(doc, gmlBuildings, lowerCorner, attributes, importSettings.CodeTranslate); if (importSettings.ImportGeomType == CityGeometry.Solid) cityModel.CreateBuildings(); diff --git a/CityBIM/GUI/City2BIM/Prop_CityGML_settings.cs b/CityBIM/GUI/City2BIM/Prop_CityGML_settings.cs index 0f2a55ac..3f2c5fc8 100644 --- a/CityBIM/GUI/City2BIM/Prop_CityGML_settings.cs +++ b/CityBIM/GUI/City2BIM/Prop_CityGML_settings.cs @@ -19,14 +19,12 @@ public class Prop_CityGML_settings //user-defined extent properties private static double extent = 300.0; - private static double[] serverCoord = new double[2] { Prop_GeoRefSettings.WgsCoord[1], Prop_GeoRefSettings.WgsCoord[0] } ; public static double Extent { get => extent; set => extent = value; } public static bool IsServerRequest { get => isServerRequest; set => isServerRequest = value; } public static string ServerUrl { get => serverUrl; set => serverUrl = value; } public static string FileUrl { get => fileUrl; set => fileUrl = value; } public static bool IsGeodeticSystem { get => isGeodeticSystem; set => isGeodeticSystem = value; } - public static double[] ServerCoord { get => serverCoord; set => serverCoord = value; } public static CityGml_Codelist.Codelist CodelistName { get => codelistName; set => codelistName = value; } public static bool SaveServerResponse { get => saveServerResponse; set => saveServerResponse = value; } public static string PathResponse { get => pathResponse; set => pathResponse = value; } diff --git a/CityBIM/GUI/DTM2BIM/Cmd_ReadTerrain.cs b/CityBIM/GUI/DTM2BIM/Cmd_ReadTerrain.cs index 8b217e48..e9d53d91 100644 --- a/CityBIM/GUI/DTM2BIM/Cmd_ReadTerrain.cs +++ b/CityBIM/GUI/DTM2BIM/Cmd_ReadTerrain.cs @@ -34,9 +34,6 @@ public Result Execute(ExternalCommandData revit, ref string message, ElementSet //get revit document Document doc = revit.Application.ActiveUIDocument.Document; - //get georef settings based on revit document - Prop_GeoRefSettings.SetInitialSettings(doc); - //init user controler (otherwise will not be able to init the window) uC.Dxf.Read ucDxf = new uC.Dxf.Read(); uC.Grid.Read ucGrid = new uC.Grid.Read(); diff --git a/CityBIM/GUI/GUI_helper.cs b/CityBIM/GUI/GUI_helper.cs deleted file mode 100644 index bd7f243c..00000000 --- a/CityBIM/GUI/GUI_helper.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; - -namespace CityBIM.GUI -{ - public class GUI_helper - { - public void setRadiobutton(RadioButton rb, ListBox lb) - { - if (rb.IsChecked == true) - { - lb.SelectAll(); - } - else - { - lb.UnselectAll(); - } - } - - public void uncheckRbWhenSelected(RadioButton rb, ListBox lb) - { - if (lb.SelectedItems.Count < lb.Items.Count) - { - rb.IsChecked = false; - } - } - } -} diff --git a/CityBIM/GUI/Georeferencing/Cmd_GeoRefUI.cs b/CityBIM/GUI/Georeferencing/Cmd_GeoRefUI.cs index 9f65e6b3..91f6f0b7 100644 --- a/CityBIM/GUI/Georeferencing/Cmd_GeoRefUI.cs +++ b/CityBIM/GUI/Georeferencing/Cmd_GeoRefUI.cs @@ -2,6 +2,7 @@ using System.Reflection; using Autodesk.Revit.DB; using Autodesk.Revit.UI; +using CityBIM.GUI.Georeferencing; namespace CityBIM.GUI { @@ -14,11 +15,11 @@ public Autodesk.Revit.UI.Result Execute(ExternalCommandData revit, ref string me { Document doc = revit.Application.ActiveUIDocument.Document; - Prop_GeoRefSettings.SetInitialSettings(doc); - - var form = new GUI.Wpf_GeoRef_Form(doc); - form.ShowDialog(); - + var viewModel = new GeoRefViewModel(doc); + var dialog = new NewGeoRefWindow(); + dialog.DataContext = viewModel; + var result = dialog.ShowDialog(); + return Result.Succeeded; } } diff --git a/CityBIM/GUI/Georeferencing/GeoRefViewModel.cs b/CityBIM/GUI/Georeferencing/GeoRefViewModel.cs new file mode 100644 index 00000000..1007481f --- /dev/null +++ b/CityBIM/GUI/Georeferencing/GeoRefViewModel.cs @@ -0,0 +1,135 @@ +using System; + +using Autodesk.Revit.DB; +using Serilog; + +using CommonRevit; +using System.Diagnostics; + +namespace CityBIM.GUI.Georeferencing +{ + public class GeoRefViewModel : BaseViewModel + { + private double eastings; + public double Eastings + { + get => eastings; + set + { + if (eastings != value) + { + eastings = value; + this.RaisePropertyChanged(); + } + } + } + private double northings; + public double Northings + { + get => northings; + set + { + if (northings != value) + { + northings = value; + this.RaisePropertyChanged(); + } + } + } + private double elevation; + public double Elevation + { + get => elevation; + set + { + if (elevation != value) + { + elevation = value; + this.RaisePropertyChanged(); + } + } + } + + private double trueNorth; + public double TrueNorth + { + get => trueNorth; + set + { + if (trueNorth != value) + { + trueNorth = value; + this.RaisePropertyChanged(); + } + } + } + private int epsgCode; + public int EPSGCode + { + get => epsgCode; + set + { + if (epsgCode != value) + { + epsgCode = value; + this.RaisePropertyChanged(); + } + } + } + + private double projectScale; + + public double ProjectScale + { + get => projectScale; + set + { + if (projectScale != value) + { + projectScale = value; + this.RaisePropertyChanged(); + } + } + } + + private Document doc; + + public GeoRefViewModel(Document doc) + { + this.doc = doc; + var pbp = utils.getProjectBasePointMeter(doc); + this.Eastings = pbp.X; + this.Northings = pbp.Y; + this.Elevation = pbp.Z; + this.TrueNorth = utils.getProjectAngleDeg(doc); + this.EPSGCode = utils.getHTWDDEPSGCode(doc); + this.ProjectScale = utils.getHTWDDProjectScale(doc); + } + + public GeoRefViewModel() + { + + } + + public void SaveSettings() + { + var pbpOld = utils.getProjectBasePointMeter(this.doc); + var angleOld = utils.getProjectAngleDeg(this.doc); + var scaleOld = utils.getHTWDDProjectScale(this.doc); + + utils.storeEPSGCodeInExtensibleStorage(this.doc, this.EPSGCode); + utils.storeProjectScaleInExtensibleStorage(this.doc, this.ProjectScale); + + using (Transaction trans = new Transaction(this.doc, "Setting Coordinates of project base point")) + { + trans.Start(); + this.doc.ActiveProjectLocation.SetProjectPosition(new XYZ(), new ProjectPosition(Eastings / 0.3048, Northings / 0.3048, Elevation / 0.3048, TrueNorth * Math.PI/180)); + trans.Commit(); + } + + Log.Information($"New Project location is: {Eastings / 0.3048} | {Northings / 0.3048} | {Elevation / 0.3048} Old Location was: {pbpOld.X} | {pbpOld.Y} | {pbpOld.Z}"); + Log.Information($"New True North is: {TrueNorth * Math.PI / 180} Old True North was: {angleOld}"); + Log.Information($"New Projece Scale is: {ProjectScale} Old Project Scale was: {scaleOld}"); + } + } +} diff --git a/CityBIM/GUI/Georeferencing/NewGeoRefWindow.xaml b/CityBIM/GUI/Georeferencing/NewGeoRefWindow.xaml new file mode 100644 index 00000000..7567fd62 --- /dev/null +++ b/CityBIM/GUI/Georeferencing/NewGeoRefWindow.xaml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -47,16 +47,16 @@ - - + + - + - @@ -72,7 +72,7 @@ - + @@ -94,8 +94,8 @@ - - + + diff --git a/CityBIM/GUI/Properties/Cmd_properties.cs b/CityBIM/GUI/Properties/Cmd_properties.cs index 60a190e0..c0ef94bb 100644 --- a/CityBIM/GUI/Properties/Cmd_properties.cs +++ b/CityBIM/GUI/Properties/Cmd_properties.cs @@ -25,8 +25,6 @@ public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData, ref str UIDocument uiDoc = commandData.Application.ActiveUIDocument; Document doc = uiDoc.Document; - Prop_GeoRefSettings.SetInitialSettings(doc); - try { Selection sel = uiDoc.Selection; diff --git a/CityBIM/GUI/Properties/PropertyWindow.xaml b/CityBIM/GUI/Properties/PropertyWindow.xaml index 3fd579c6..ff6c1583 100644 --- a/CityBIM/GUI/Properties/PropertyWindow.xaml +++ b/CityBIM/GUI/Properties/PropertyWindow.xaml @@ -6,7 +6,7 @@ xmlns:local="clr-namespace:CityBIM.GUI.Properties" xmlns:lang="clr-namespace:CityBIM" mc:Ignorable="d" - Width="600" MinWidth="600" MinHeight="700" Height="700" Title="{x:Static lang:Localization.PropertyWindow}"> + Width="600" MinWidth="600" MinHeight="700" Height="700" Title="Properties for selected object"> @@ -27,8 +27,8 @@ - - + + diff --git a/CityBIM/GUI/UI_PlugIn.cs b/CityBIM/GUI/UI_PlugIn.cs index 0ef31769..9cba5801 100644 --- a/CityBIM/GUI/UI_PlugIn.cs +++ b/CityBIM/GUI/UI_PlugIn.cs @@ -34,12 +34,11 @@ public Result OnStartup(UIControlledApplication application) Log.Information("CityBIM-Application started!"); - //Log.Information("assumed log path is: " + assumedLogPath); #region Georef panel RibbonPanel panelGeoref = application.CreateRibbonPanel(tabName, "Georeferencing"); - PushButton buttonGeoRef = panelGeoref.AddItem(new PushButtonData("Show Georef information", "Level of Georef", thisAssemblyPath, "CityBIM.GUI.Cmd_GeoRefUI")) as PushButton; + PushButton buttonGeoRef = panelGeoref.AddItem(new PushButtonData("Show Georef information", "Georeference Project", thisAssemblyPath, "CityBIM.GUI.Cmd_GeoRefUI")) as PushButton; buttonGeoRef.ToolTip = "Show georef information for current project."; buttonGeoRef.LargeImage = getBitmapFromResx(ResourcePictures.Georef_32px_96dpi); @@ -90,8 +89,8 @@ public Result OnStartup(UIControlledApplication application) #region modify panel RibbonPanel panelModify = application.CreateRibbonPanel(tabName, "Modify"); - PushButton buttonHideLayer = panelModify.AddItem(new PushButtonData("Hide surfaces.", "Hides surfaces", thisAssemblyPath, "CityBIM.GUI.Modify.Cmd_HideLayers")) as PushButton; - buttonHideLayer.ToolTip = "Hide surfaces by its theme."; + PushButton buttonHideLayer = panelModify.AddItem(new PushButtonData("Hide Objects.", "Hide Objects", thisAssemblyPath, "CityBIM.GUI.Modify.Cmd_HideLayers")) as PushButton; + buttonHideLayer.ToolTip = "Hide objects by their theme."; buttonHideLayer.LargeImage = getBitmapFromResx(ResourcePictures.HideLayerIcon_32px_96dpi); #endregion modify panel @@ -171,10 +170,5 @@ private BitmapImage getBitmapFromResx(System.Drawing.Bitmap bmp) return img; } - - //public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) - //{ - // throw new NotImplementedException(); - //} } } \ No newline at end of file diff --git a/CityBIM/GUI/XPlan2BIM/Cmd_ImportXPlan.cs b/CityBIM/GUI/XPlan2BIM/Cmd_ImportXPlan.cs index 348376ed..f59f72a2 100644 --- a/CityBIM/GUI/XPlan2BIM/Cmd_ImportXPlan.cs +++ b/CityBIM/GUI/XPlan2BIM/Cmd_ImportXPlan.cs @@ -31,7 +31,6 @@ public Autodesk.Revit.UI.Result Execute(ExternalCommandData revit, ref string me { UIDocument uiDoc = revit.Application.ActiveUIDocument; Document doc = uiDoc.Document; - Prop_GeoRefSettings.SetInitialSettings(doc); //MetaInformation.createXPlanungSchema(doc); ElementId terrainId = utils.getHTWDDTerrainID(doc); diff --git a/CityBIM/GUI/XPlan2BIM/ImportXPlanDialog.xaml b/CityBIM/GUI/XPlan2BIM/ImportXPlanDialog.xaml index 99870ff1..5abeda46 100644 --- a/CityBIM/GUI/XPlan2BIM/ImportXPlanDialog.xaml +++ b/CityBIM/GUI/XPlan2BIM/ImportXPlanDialog.xaml @@ -5,7 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:CityBIM.GUI.XPlan2BIM" xmlns:lang="clr-namespace:CityBIM" - mc:Ignorable="d" + mc:Ignorable="d" Title="Import XPlan" d:DesignHeight="600" d:DesignWidth="500" Width="550" Height="620" MinWidth="550" MinHeight="620"> @@ -17,11 +17,11 @@ - + - + - + @@ -48,16 +48,16 @@ - - + + - + - @@ -95,8 +95,8 @@ - - + + diff --git a/CityBIM/Localization.Designer.cs b/CityBIM/Localization.Designer.cs deleted file mode 100644 index 284eb95c..00000000 --- a/CityBIM/Localization.Designer.cs +++ /dev/null @@ -1,1134 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace CityBIM { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - public class Localization { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Localization() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CityBIM.Localization", typeof(Localization).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to save. - /// - public static string DataCatalogEditorWindow_id1 { - get { - return ResourceManager.GetString("DataCatalogEditorWindow_id1", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to cancel. - /// - public static string DataCatalogEditorWindow_id2 { - get { - return ResourceManager.GetString("DataCatalogEditorWindow_id2", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Query External Data Catalog. - /// - public static string findSubjectResultForm { - get { - return ResourceManager.GetString("findSubjectResultForm", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to close. - /// - public static string findSubjectResultForm_closeBtn { - get { - return ResourceManager.GetString("findSubjectResultForm_closeBtn", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Search text for subjects. - /// - public static string findSubjectResultForm_id1 { - get { - return ResourceManager.GetString("findSubjectResultForm_id1", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to query. - /// - public static string findSubjectResultForm_queryBtn { - get { - return ResourceManager.GetString("findSubjectResultForm_queryBtn", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to set selected object. - /// - public static string findSubjectResultForm_setObjectBtn { - get { - return ResourceManager.GetString("findSubjectResultForm_setObjectBtn", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to CityBIM IfcExport. - /// - public static string IfcExportDialog { - get { - return ResourceManager.GetString("IfcExportDialog", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to cancel. - /// - public static string IfcExportDialog_cancelBtn { - get { - return ResourceManager.GetString("IfcExportDialog_cancelBtn", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to export. - /// - public static string IfcExportDialog_exportBtn { - get { - return ResourceManager.GetString("IfcExportDialog_exportBtn", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Export File. - /// - public static string IfcExportDialog_FileLabel { - get { - return ResourceManager.GetString("IfcExportDialog_FileLabel", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to IfcGeographicElement. - /// - public static string IfcExportDialog_geogElemRadioBtn { - get { - return ResourceManager.GetString("IfcExportDialog_geogElemRadioBtn", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Select Alkis / XPlanung Export Type. - /// - public static string IfcExportDialog_id1 { - get { - return ResourceManager.GetString("IfcExportDialog_id1", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Save As. - /// - public static string IfcExportDialog_saveAsButton { - get { - return ResourceManager.GetString("IfcExportDialog_saveAsButton", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to IfcSite. - /// - public static string IfcExportDialog_siteRadioBtn { - get { - return ResourceManager.GetString("IfcExportDialog_siteRadioBtn", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Browse. - /// - public static string ImportDialogAlkis_browseButton { - get { - return ResourceManager.GetString("ImportDialogAlkis_browseButton", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to cancel. - /// - public static string ImportDialogAlkis_cancelButton { - get { - return ResourceManager.GetString("ImportDialogAlkis_cancelButton", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Clear All. - /// - public static string ImportDialogAlkis_clearSelectionBtn { - get { - return ResourceManager.GetString("ImportDialogAlkis_clearSelectionBtn", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to File. - /// - public static string ImportDialogAlkis_FileLabel { - get { - return ResourceManager.GetString("ImportDialogAlkis_FileLabel", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Layers to Import. - /// - public static string ImportDialogAlkis_id1 { - get { - return ResourceManager.GetString("ImportDialogAlkis_id1", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Drape on Terrain. - /// - public static string ImportDialogAlkis_id2 { - get { - return ResourceManager.GetString("ImportDialogAlkis_id2", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to drape objects on imported terrain. - /// - public static string ImportDialogAlkis_id3 { - get { - return ResourceManager.GetString("ImportDialogAlkis_id3", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to import. - /// - public static string ImportDialogAlkis_importButton { - get { - return ResourceManager.GetString("ImportDialogAlkis_importButton", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Select All. - /// - public static string ImportDialogAlkis_selectAllBtn { - get { - return ResourceManager.GetString("ImportDialogAlkis_selectAllBtn", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Browse. - /// - public static string ImportXPlanDialog_browseButton { - get { - return ResourceManager.GetString("ImportXPlanDialog_browseButton", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to cancel. - /// - public static string ImportXPlanDialog_cancelButton { - get { - return ResourceManager.GetString("ImportXPlanDialog_cancelButton", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Clear All. - /// - public static string ImportXPlanDialog_clearSelectionBtn { - get { - return ResourceManager.GetString("ImportXPlanDialog_clearSelectionBtn", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to File. - /// - public static string ImportXPlanDialog_FileLabel { - get { - return ResourceManager.GetString("ImportXPlanDialog_FileLabel", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Layers to Import. - /// - public static string ImportXPlanDialog_id1 { - get { - return ResourceManager.GetString("ImportXPlanDialog_id1", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Drape on Terrain. - /// - public static string ImportXPlanDialog_id2 { - get { - return ResourceManager.GetString("ImportXPlanDialog_id2", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to drape objects on imported terrain. - /// - public static string ImportXPlanDialog_id3 { - get { - return ResourceManager.GetString("ImportXPlanDialog_id3", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to import. - /// - public static string ImportXPlanDialog_importButton { - get { - return ResourceManager.GetString("ImportXPlanDialog_importButton", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Select All. - /// - public static string ImportXPlanDialog_selectAllBtn { - get { - return ResourceManager.GetString("ImportXPlanDialog_selectAllBtn", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to LayerSelector. - /// - public static string LayerSelector { - get { - return ResourceManager.GetString("LayerSelector", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to apply. - /// - public static string LayerSelector_apply { - get { - return ResourceManager.GetString("LayerSelector_apply", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to cancel. - /// - public static string LayerSelector_cancel { - get { - return ResourceManager.GetString("LayerSelector_cancel", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to select all. - /// - public static string LayerSelector_selectAll { - get { - return ResourceManager.GetString("LayerSelector_selectAll", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to unselect all. - /// - public static string LayerSelector_unSelectAll { - get { - return ResourceManager.GetString("LayerSelector_unSelectAll", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Login to External Data Catalog. - /// - public static string LoginScreen_id1 { - get { - return ResourceManager.GetString("LoginScreen_id1", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Server-Url. - /// - public static string LoginScreen_id2 { - get { - return ResourceManager.GetString("LoginScreen_id2", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Username. - /// - public static string LoginScreen_id3 { - get { - return ResourceManager.GetString("LoginScreen_id3", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Password. - /// - public static string LoginScreen_id4 { - get { - return ResourceManager.GetString("LoginScreen_id4", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Submit. - /// - public static string LoginScreen_id5 { - get { - return ResourceManager.GetString("LoginScreen_id5", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Attributes for Object. - /// - public static string PropertyWindow { - get { - return ResourceManager.GetString("PropertyWindow", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to save and close. - /// - public static string PropertyWindow_id1 { - get { - return ResourceManager.GetString("PropertyWindow_id1", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to cancel. - /// - public static string PropertyWindow_id2 { - get { - return ResourceManager.GetString("PropertyWindow_id2", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Settings. - /// - public static string Wpf_CityGML_settings { - get { - return ResourceManager.GetString("Wpf_CityGML_settings", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Apply. - /// - public static string Wpf_CityGML_settingsButton_bt_applyGeoref { - get { - return ResourceManager.GetString("Wpf_CityGML_settingsButton_bt_applyGeoref", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Codelist translation. - /// - public static string Wpf_CityGML_settingsGroupBox_gr_code_header { - get { - return ResourceManager.GetString("Wpf_CityGML_settingsGroupBox_gr_code_header", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to of codes into its meaning. - /// - public static string Wpf_CityGML_settingsGroupBox_gr_code_lbl8 { - get { - return ResourceManager.GetString("Wpf_CityGML_settingsGroupBox_gr_code_lbl8", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to use Codelist for translation. - /// - public static string Wpf_CityGML_settingsGroupBox_gr_code_lbl9 { - get { - return ResourceManager.GetString("Wpf_CityGML_settingsGroupBox_gr_code_lbl9", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Browse.... - /// - public static string Wpf_CityGML_settingsGroupBox_gr_prop_Bt_browse { - get { - return ResourceManager.GetString("Wpf_CityGML_settingsGroupBox_gr_prop_Bt_browse", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to File settings. - /// - public static string Wpf_CityGML_settingsGroupBox_gr_prop_header { - get { - return ResourceManager.GetString("Wpf_CityGML_settingsGroupBox_gr_prop_header", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to File:. - /// - public static string Wpf_CityGML_settingsGroupBox_gr_prop_lbl6 { - get { - return ResourceManager.GetString("Wpf_CityGML_settingsGroupBox_gr_prop_lbl6", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Order of coordinates:. - /// - public static string Wpf_CityGML_settingsGroupBox_gr_prop_lbl7 { - get { - return ResourceManager.GetString("Wpf_CityGML_settingsGroupBox_gr_prop_lbl7", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to XYZ / NEH (Northings, Eastings, Height). - /// - public static string Wpf_CityGML_settingsGroupBox_gr_prop_rb_XYZ { - get { - return ResourceManager.GetString("Wpf_CityGML_settingsGroupBox_gr_prop_rb_XYZ", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to YXZ / ENH (Eastings, Northings, Height. - /// - public static string Wpf_CityGML_settingsGroupBox_gr_prop_rb_YXZ { - get { - return ResourceManager.GetString("Wpf_CityGML_settingsGroupBox_gr_prop_rb_YXZ", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Edit URL. - /// - public static string Wpf_CityGML_settingsGroupBox_gr_server_bt_editUrl { - get { - return ResourceManager.GetString("Wpf_CityGML_settingsGroupBox_gr_server_bt_editUrl", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to save response to. - /// - public static string Wpf_CityGML_settingsGroupBox_gr_server_check_saveResponse { - get { - return ResourceManager.GetString("Wpf_CityGML_settingsGroupBox_gr_server_check_saveResponse", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Server Settings. - /// - public static string Wpf_CityGML_settingsGroupBox_gr_server_header { - get { - return ResourceManager.GetString("Wpf_CityGML_settingsGroupBox_gr_server_header", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to URL:. - /// - public static string Wpf_CityGML_settingsGroupBox_gr_server_lbl1 { - get { - return ResourceManager.GetString("Wpf_CityGML_settingsGroupBox_gr_server_lbl1", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Center:. - /// - public static string Wpf_CityGML_settingsGroupBox_gr_server_lbl2 { - get { - return ResourceManager.GetString("Wpf_CityGML_settingsGroupBox_gr_server_lbl2", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Lat. - /// - public static string Wpf_CityGML_settingsGroupBox_gr_server_lbl3 { - get { - return ResourceManager.GetString("Wpf_CityGML_settingsGroupBox_gr_server_lbl3", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Lon. - /// - public static string Wpf_CityGML_settingsGroupBox_gr_server_lbl4 { - get { - return ResourceManager.GetString("Wpf_CityGML_settingsGroupBox_gr_server_lbl4", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Extent:. - /// - public static string Wpf_CityGML_settingsGroupBox_gr_server_lbl5 { - get { - return ResourceManager.GetString("Wpf_CityGML_settingsGroupBox_gr_server_lbl5", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to custom. - /// - public static string Wpf_CityGML_settingsGroupBox_gr_server_Rb_custom { - get { - return ResourceManager.GetString("Wpf_CityGML_settingsGroupBox_gr_server_Rb_custom", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to from Site location. - /// - public static string Wpf_CityGML_settingsGroupBox_gr_server_rb_site { - get { - return ResourceManager.GetString("Wpf_CityGML_settingsGroupBox_gr_server_rb_site", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Source. - /// - public static string Wpf_CityGML_settingsGroupBox_gr_source_header { - get { - return ResourceManager.GetString("Wpf_CityGML_settingsGroupBox_gr_source_header", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to CityGML file. - /// - public static string Wpf_CityGML_settingsGroupBox_gr_source_rb_file { - get { - return ResourceManager.GetString("Wpf_CityGML_settingsGroupBox_gr_source_rb_file", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to VCS server. - /// - public static string Wpf_CityGML_settingsGroupBox_gr_source_rb_server { - get { - return ResourceManager.GetString("Wpf_CityGML_settingsGroupBox_gr_source_rb_server", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Select theme. - /// - public static string Wpf_CreateMetaJSON { - get { - return ResourceManager.GetString("Wpf_CreateMetaJSON", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Start. - /// - public static string Wpf_CreateMetaJSON_Btn_Start { - get { - return ResourceManager.GetString("Wpf_CreateMetaJSON_Btn_Start", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Select a theme. - /// - public static string Wpf_CreateMetaJSON_Cb_Theme { - get { - return ResourceManager.GetString("Wpf_CreateMetaJSON_Cb_Theme", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Georeferencing. - /// - public static string Wpf_GeoRef_Form { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Apply. - /// - public static string Wpf_GeoRef_Form_bt_applyGeoref { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_bt_applyGeoref", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Close. - /// - public static string Wpf_GeoRef_Form_bt_quit { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_bt_quit", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Postal Address. - /// - public static string Wpf_GeoRef_Form_group10 { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_group10", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Address lines:. - /// - public static string Wpf_GeoRef_Form_id1 { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_id1", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Projected coordinates. - /// - public static string Wpf_GeoRef_Form_id10 { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_id10", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Eastings [m]:. - /// - public static string Wpf_GeoRef_Form_id11 { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_id11", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Northings [m]:. - /// - public static string Wpf_GeoRef_Form_id12 { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_id12", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Grid North [°]:. - /// - public static string Wpf_GeoRef_Form_id13 { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_id13", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Scale:. - /// - public static string Wpf_GeoRef_Form_id14 { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_id14", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to EPSG-Code (CRS):. - /// - public static string Wpf_GeoRef_Form_id15 { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_id15", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Elevation. - /// - public static string Wpf_GeoRef_Form_id16 { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_id16", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Orthometric Height [m]:. - /// - public static string Wpf_GeoRef_Form_id17 { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_id17", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Vertical Datum:. - /// - public static string Wpf_GeoRef_Form_id18 { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_id18", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to UTM transformation. - /// - public static string Wpf_GeoRef_Form_id19 { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_id19", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Postal Code:. - /// - public static string Wpf_GeoRef_Form_id2 { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_id2", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Calculate. - /// - public static string Wpf_GeoRef_Form_id20 { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_id20", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Town:. - /// - public static string Wpf_GeoRef_Form_id3 { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_id3", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Region:. - /// - public static string Wpf_GeoRef_Form_id4 { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_id4", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Country:. - /// - public static string Wpf_GeoRef_Form_id5 { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_id5", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Geographic site coordinates. - /// - public static string Wpf_GeoRef_Form_id6 { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_id6", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Latitude [°]:. - /// - public static string Wpf_GeoRef_Form_id7 { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_id7", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Longitude [°]:. - /// - public static string Wpf_GeoRef_Form_id8 { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_id8", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to True North [°]:. - /// - public static string Wpf_GeoRef_Form_id9 { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_id9", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Deg. - /// - public static string Wpf_GeoRef_Form_rb_deg { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_rb_deg", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to DMS. - /// - public static string Wpf_GeoRef_Form_rb_dms { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_rb_dms", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Projection (UTM) to Site (LatLon). - /// - public static string Wpf_GeoRef_Form_rb_projToSite { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_rb_projToSite", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Site (LatLon) to Projection (UTM). - /// - public static string Wpf_GeoRef_Form_rb_siteToProj { - get { - return ResourceManager.GetString("Wpf_GeoRef_Form_rb_siteToProj", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Select layer. - /// - public static string Wpf_showLayer { - get { - return ResourceManager.GetString("Wpf_showLayer", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Choose. - /// - public static string Wpf_showLayer_btn_choose { - get { - return ResourceManager.GetString("Wpf_showLayer_btn_choose", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Browse. - /// - public static string Wpf_showLayer_btn_exportjson { - get { - return ResourceManager.GetString("Wpf_showLayer_btn_exportjson", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Browse. - /// - public static string Wpf_showLayer_btn_gml { - get { - return ResourceManager.GetString("Wpf_showLayer_btn_gml", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Browse. - /// - public static string Wpf_showLayer_btn_metajson { - get { - return ResourceManager.GetString("Wpf_showLayer_btn_metajson", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to GML. - /// - public static string Wpf_showLayer_id1 { - get { - return ResourceManager.GetString("Wpf_showLayer_id1", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Meta JSON. - /// - public static string Wpf_showLayer_id2 { - get { - return ResourceManager.GetString("Wpf_showLayer_id2", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Export JSON. - /// - public static string Wpf_showLayer_id3 { - get { - return ResourceManager.GetString("Wpf_showLayer_id3", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Export to IFC. - /// - public static string Wpf_XPlan2IFC { - get { - return ResourceManager.GetString("Wpf_XPlan2IFC", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Export surfaces as IfcSite. - /// - public static string Wpf_XPlan2IFC_checkboxAsSite { - get { - return ResourceManager.GetString("Wpf_XPlan2IFC_checkboxAsSite", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Export surfaces as IfcSpace. - /// - public static string Wpf_XPlan2IFC_checkboxAsSpace { - get { - return ResourceManager.GetString("Wpf_XPlan2IFC_checkboxAsSpace", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to File Location. - /// - public static string Wpf_XPlan2IFC_id1 { - get { - return ResourceManager.GetString("Wpf_XPlan2IFC_id1", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to File name. - /// - public static string Wpf_XPlan2IFC_id2 { - get { - return ResourceManager.GetString("Wpf_XPlan2IFC_id2", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Layer to be exported. - /// - public static string Wpf_XPlan2IFC_id3 { - get { - return ResourceManager.GetString("Wpf_XPlan2IFC_id3", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Clear Selection. - /// - public static string Wpf_XPlan2IFC_id4 { - get { - return ResourceManager.GetString("Wpf_XPlan2IFC_id4", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Export to IFC. - /// - public static string Wpf_XPlan2IFC_id5 { - get { - return ResourceManager.GetString("Wpf_XPlan2IFC_id5", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Close. - /// - public static string Wpf_XPlan2IFC_id6 { - get { - return ResourceManager.GetString("Wpf_XPlan2IFC_id6", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Select all. - /// - public static string Wpf_XPlan2IFC_rb_selectAll { - get { - return ResourceManager.GetString("Wpf_XPlan2IFC_rb_selectAll", resourceCulture); - } - } - } -} diff --git a/CityBIM/Localization.de.Designer.cs b/CityBIM/Localization.de.Designer.cs deleted file mode 100644 index e69de29b..00000000 diff --git a/CityBIM/Localization.de.resx b/CityBIM/Localization.de.resx deleted file mode 100644 index 7d0c8a0f..00000000 --- a/CityBIM/Localization.de.resx +++ /dev/null @@ -1,477 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - speichern - - - abbrechen - - - Abfrage externer Datenkatalog - - - schließen - - - Texteingabe für die Suche nach Themen - - - abfragen - - - ausgewähltes Objekt setzen - - - City2RVT IfcExport - - - abbrechen - - - exportieren - - - Export-Datei - - - IfcGeographicElement - - - Auswahl Alkis / XPlanung Export-Typ - - - Speichern unter - - - IfcSite - - - Durchsuchen - - - abbrechen - - - Alle entfernen - - - Datei - - - zu importierende Layer - - - Auf Gelände projezieren - - - Objekte auf importiertes Gelände projezieren - - - importieren - - - Alle auswählen - - - Durchsuchen - - - abbrechen - - - Alle entfernen - - - Datei - - - zu importierende Layer - - - Auf Gelände projezieren - - - Objekte auf importiertes Gelände projezieren - - - importieren - - - Alle auswählen - - - LayerSelector - - - übernehmen - - - abbrechen - - - Alle auswählen - - - Alle abwählen - - - Login zum externen Datenkatalog - - - Server-Url - - - Benutzername - - - Passwort - - - Absenden - - - Attribute für das Objekt - - - speichern und schließen - - - abbrechen - - - Einstellungen - - - Übernehmen - - - Codelisten-Übersetzung - - - in ihre Bedeutung verwenden - - - Codeliste zur Übersetzung von Codes - - - Durchsuchen... - - - Datei-Einstellungen - - - Datei: - - - Reihenfolge der Koordinaten: - - - XYZ / NOH (Nordwert, Ostwert, Höhe) - - - YXZ / ONH (Ostwert, Nordwert, Höhe - - - URL bearbeiten - - - Antwort speichern unter - - - Server-Einstellungen - - - URL: - - - Mittelpunkt: - - - geogr. Breite - - - geogr. Länge - - - räuml. Ausdehnung: - - - benutzerdefiniert - - - vom Standort - - - Quelle - - - CityGML-Datei - - - VCS server - - - Thema auswählen - - - Start - - - Wähle ein Thema - - - Georeferenzierung - - - Übernehmen - - - Schließen - - - Postanschrift - - - Adresszeilen: - - - Projizierte Koordinaten - - - Ostwert [m]: - - - Nordwert [m]: - - - Gitternord [°]: - - - Maßstab: - - - EPSG-Code (KRS): - - - Höhe - - - Orthometrische Höhe [m]: - - - Höhendatum: - - - UTM Transformation - - - Postleitzahl (PLZ): - - - Berechnen - - - Ort: - - - Bundesland / Kanton: - - - Land: - - - Geographische Standortkoordinaten - - - Breite [°]: - - - Länge [°]: - - - Geogr. Nord [°]: - - - Grad - - - DMS (Grad, Min., Sek.) - - - Projektion (UTM) zu Standort (Breite/Länge) - - - Standort (Breite/Länge) to Projektion (UTM) - - - Layer auswählen - - - Auswählen - - - Durchsuchen - - - Durchsuchen - - - Durchsuchen - - - GML - - - Meta JSON - - - Export JSON - - - Export nach IFC - - - Exportiere Oberflächen als IfcSite - - - Exportiere Oberflächen als IfcSpace - - - Datei-Speicherort - - - Dateiname - - - zu exportierende Layer - - - Auswahl aufheben - - - Export nach IFC - - - Schließen - - - Alle auswählen - - \ No newline at end of file diff --git a/CityBIM/Localization.resx b/CityBIM/Localization.resx deleted file mode 100644 index 899cd8f5..00000000 --- a/CityBIM/Localization.resx +++ /dev/null @@ -1,477 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - save - - - cancel - - - Query External Data Catalog - - - close - - - Search text for subjects - - - query - - - set selected object - - - CityBIM IfcExport - - - cancel - - - export - - - Export File - - - IfcGeographicElement - - - Select Alkis / XPlanung Export Type - - - Save As - - - IfcSite - - - Browse - - - cancel - - - Clear All - - - File - - - Layers to Import - - - Drape on Terrain - - - drape objects on imported terrain - - - import - - - Select All - - - Browse - - - cancel - - - Clear All - - - File - - - Layers to Import - - - Drape on Terrain - - - drape objects on imported terrain - - - import - - - Select All - - - LayerSelector - - - apply - - - cancel - - - select all - - - unselect all - - - Login to External Data Catalog - - - Server-Url - - - Username - - - Password - - - Submit - - - Attributes for Object - - - save and close - - - cancel - - - Settings - - - Apply - - - Codelist translation - - - of codes into its meaning - - - use Codelist for translation - - - Browse... - - - File settings - - - File: - - - Order of coordinates: - - - XYZ / NEH (Northings, Eastings, Height) - - - YXZ / ENH (Eastings, Northings, Height - - - Edit URL - - - save response to - - - Server Settings - - - URL: - - - Center: - - - Lat - - - Lon - - - Extent: - - - custom - - - from Site location - - - Source - - - CityGML file - - - VCS server - - - Select theme - - - Start - - - Select a theme - - - Georeferencing - - - Apply - - - Close - - - Postal Address - - - Address lines: - - - Projected coordinates - - - Eastings [m]: - - - Northings [m]: - - - Grid North [°]: - - - Scale: - - - EPSG-Code (CRS): - - - Elevation - - - Orthometric Height [m]: - - - Vertical Datum: - - - UTM transformation - - - Postal Code: - - - Calculate - - - Town: - - - Region: - - - Country: - - - Geographic site coordinates - - - Latitude [°]: - - - Longitude [°]: - - - True North [°]: - - - Deg - - - DMS - - - Projection (UTM) to Site (LatLon) - - - Site (LatLon) to Projection (UTM) - - - Select layer - - - Choose - - - Browse - - - Browse - - - Browse - - - GML - - - Meta JSON - - - Export JSON - - - Export to IFC - - - Export surfaces as IfcSite - - - Export surfaces as IfcSpace - - - File Location - - - File name - - - Layer to be exported - - - Clear Selection - - - Export to IFC - - - Close - - - Select all - - \ No newline at end of file diff --git a/CityBIM/Prop_Revit.cs b/CityBIM/Prop_Revit.cs index 37776c11..bc3de63f 100644 --- a/CityBIM/Prop_Revit.cs +++ b/CityBIM/Prop_Revit.cs @@ -1,14 +1,10 @@ using Autodesk.Revit.DB; -using System.Windows.Forms; using System; -using System.IdentityModel.Tokens.Jwt; - namespace CityBIM { public static class Prop_Revit { - private static Transform trafoPBP = SetRevitProjectTransformation(); private static ElementId terrainId; private static ElementId pickedId; private static Element pickedElement; @@ -20,31 +16,5 @@ public static class Prop_Revit public static ElementId PickedId { get => pickedId; set => pickedId = value; } public static Element PickedElement { get => pickedElement; set => pickedElement = value; } - public static Transform TrafoPBP { get => SetRevitProjectTransformation() /*trafoPBP*/; } - - /// - /// Creates a Revit Transform object - /// - /// Revit document - /// Revit transformation matrix - private static Transform SetRevitProjectTransformation() - { - XYZ vectorPBP = - new XYZ(GUI.Prop_GeoRefSettings.ProjCoord[1] / feetToM, GUI.Prop_GeoRefSettings.ProjCoord[0] / feetToM, GUI.Prop_GeoRefSettings.ProjElevation / feetToM); - - //MessageBox.Show((GUI.Prop_GeoRefSettings.ProjCoord[1] / feetToM).ToString()); - //MessageBox.Show((GUI.Prop_GeoRefSettings.ProjCoord[0] / feetToM).ToString()); - - - double angle = GUI.Prop_GeoRefSettings.ProjAngle / Prop_Revit.radToDeg; - - using (Transform trot = Transform.CreateRotation(Autodesk.Revit.DB.XYZ.BasisZ, -angle)) - { - Transform ttrans = Transform.CreateTranslation(-vectorPBP); - Transform transf = trot.Multiply(ttrans); - - return transf; - } - } } } diff --git a/CityBIM/Reader/ReadCityGML.cs b/CityBIM/Reader/ReadCityGML.cs index 9a3f000a..d99bc8cc 100644 --- a/CityBIM/Reader/ReadCityGML.cs +++ b/CityBIM/Reader/ReadCityGML.cs @@ -20,43 +20,11 @@ public ReadCityGML(Document doc, bool solid) { XDocument gmlDoc; - if (Prop_CityGML_settings.IsServerRequest) - { - //server url as specified (if no change VCS server will be called) - string wfsUrl = Prop_CityGML_settings.ServerUrl; - - //to ensure correct coordinate order (VCS response is always YXZ order) - Prop_CityGML_settings.IsGeodeticSystem = true; - - //client class for xml-POST request from WFS server - WFSClient client = new WFSClient(wfsUrl); - - //response with parameters: Site-Lon, Site-Lat, extent, max response of bldgs, CRS) - //Site coordinates from Revit.SiteLocation - //extent from used-defined def (default: 300 m) - //max response dependent of server settings (at VCS), currently 500 - //CRS: supported from server are currently: Pseudo-Mercator (3857), LatLon (4326), German National Systems: West(25832), East(25833) - // supported by PlugIn are only the both German National Systems + //local file path + var path = Prop_CityGML_settings.FileUrl; - if (Prop_GeoRefSettings.Epsg != "EPSG:25832" && Prop_GeoRefSettings.Epsg != "EPSG:25833") - TaskDialog.Show("EPSG not supported!", "Only EPSG:25832 or EPSG:25833 will be supported by server. Please change the EPSG-Code in Georeferencing window."); - - gmlDoc = client.getFeaturesCircle(Prop_CityGML_settings.ServerCoord[0], Prop_CityGML_settings.ServerCoord[1], Prop_CityGML_settings.Extent, 500, Prop_GeoRefSettings.Epsg); - - if (Prop_CityGML_settings.SaveServerResponse) - { - gmlDoc.Save(Prop_CityGML_settings.PathResponse + "\\" + Math.Round(Prop_CityGML_settings.ServerCoord[1], 4) + "_" + Math.Round(Prop_CityGML_settings.ServerCoord[0], 4) + ".gml"); - } - } - else - { - //local file path - var path = Prop_CityGML_settings.FileUrl; - - //Load XML document from local file - gmlDoc = XDocument.Load(path); - - } + //Load XML document from local file + gmlDoc = XDocument.Load(path); var gmlRead = new CityGMLReader(gmlDoc, solid); /*gmlDoc,*/ /*, user-defined calculation parameters may from extended GUI or from config file*/ diff --git a/CityBIM/egm2008.egm b/CityBIM/egm2008.egm deleted file mode 100644 index 62ed6023..00000000 --- a/CityBIM/egm2008.egm +++ /dev/null @@ -1,23 +0,0 @@ -EGMF-1 -# An Earth Gravity Model (Format 1) file. For documentation on the -# format of this file see -# http://geographiclib.sf.net/html/gravity.html#gravityformat -Name egm2008 -Publisher National Geospatial Intelligence Agency -Description Earth Gravity Model 2008 -URL http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008 -ReleaseDate 2008-06-01 -ConversionDate 2011-11-19 -DataVersion 1 -ModelRadius 6378136.3 -ModelMass 3986004.415e8 -AngularVelocity 7292115e-11 -ReferenceRadius 6378137 -ReferenceMass 3986004.418e8 -Flattening 1/298.257223563 -HeightOffset -0.41 - -# Gravitational and correction coefficients taken from -# EGM2008_to2190_TideFree and Zeta-to-N_to2160_egm2008 from -# the egm2008 distribution. -ID EGM2008A diff --git a/CityBIM/egm2008.egm.cof b/CityBIM/egm2008.egm.cof deleted file mode 100644 index e3d1f74c..00000000 Binary files a/CityBIM/egm2008.egm.cof and /dev/null differ diff --git a/CityBIM/utils.cs b/CityBIM/utils.cs index 741758b2..b6adecea 100644 --- a/CityBIM/utils.cs +++ b/CityBIM/utils.cs @@ -10,6 +10,7 @@ using OSGeo.GDAL; using OSGeo.OGR; using Serilog; +using Autodesk.Revit.UI; namespace CityBIM { @@ -91,6 +92,171 @@ public static ElementId getHTWDDTerrainID(Document doc) return null; } + public static double getHTWDDProjectScale(Document doc) + { + Schema scaleSchema = getSchemaByName("HTWDD_GeorefSchema"); + if (scaleSchema == null) { return 1.0; } + + FilteredElementCollector collector = new FilteredElementCollector(doc); + IList dataStorageList = collector.OfClass(typeof(DataStorage)).ToElements(); + + foreach (var ds in dataStorageList) + { + Entity ent = ds.GetEntity(scaleSchema); + + if (ent.IsValid()) + { + double scale = ent.Get(scaleSchema.GetField("ProjectScale"), UnitTypeId.Custom); + + if (scale != 1.0) { return scale; } + else { return 1.0;} + } + } + + return 1.0; + } + + public static int getHTWDDEPSGCode(Document doc) + { + Schema scaleSchema = getSchemaByName("HTWDD_GeorefSchema"); + if (scaleSchema == null) { return -999; } + + FilteredElementCollector collector = new FilteredElementCollector(doc); + IList dataStorageList = collector.OfClass(typeof(DataStorage)).ToElements(); + + foreach (var ds in dataStorageList) + { + Entity ent = ds.GetEntity(scaleSchema); + + if (ent.IsValid()) + { + int epsg = ent.Get(scaleSchema.GetField("EPSGCode"), UnitTypeId.Custom); + + if (epsg != 0) { return epsg; } + else { return -999; } + } + } + + return -999; + } + + public static void storeProjectScaleInExtensibleStorage(Document doc, double Scale) + { + using (Transaction trans = new Transaction(doc, "Store Project Scale")) + { + trans.Start(); + Schema geoRefSchema = getSchemaByName("HTWDD_GeorefSchema"); + if (geoRefSchema == null) { geoRefSchema = createHTWGeorefSchema(doc); } + + FilteredElementCollector collector = new FilteredElementCollector(doc); + IList dataStorageList = collector.OfClass(typeof(DataStorage)).ToElements(); + + Entity existingEnt; + if (dataStorageList.Count > 0) + { + bool entityFound = false; + foreach (var ds in dataStorageList) + { + existingEnt = ds.GetEntity(geoRefSchema); + if (existingEnt.IsValid()) + { + existingEnt.Set("ProjectScale", Scale, UnitTypeId.Custom); + ds.SetEntity(existingEnt); + entityFound = true; + break; + } + } + if (!entityFound) + { + DataStorage geoRefStorage = DataStorage.Create(doc); + Entity ent = new Entity(geoRefSchema); + Field projectScaleField = geoRefSchema.GetField("ProjectScale"); + ent.Set(projectScaleField, Scale, UnitTypeId.Custom); + geoRefStorage.SetEntity(ent); + } + } + else + { + DataStorage geoRefStorage = DataStorage.Create(doc); + Entity ent = new Entity(geoRefSchema); + Field projectScaleField = geoRefSchema.GetField("ProjectScale"); + ent.Set(projectScaleField, Scale, UnitTypeId.Custom); + geoRefStorage.SetEntity(ent); + } + + trans.Commit(); + } + } + + public static void storeEPSGCodeInExtensibleStorage(Document doc, int EPSGCode) + { + using (Transaction trans = new Transaction(doc, "Store EPSG Code")) + { + trans.Start(); + Schema geoRefSchema = getSchemaByName("HTWDD_GeorefSchema"); + if (geoRefSchema == null) { geoRefSchema = createHTWGeorefSchema(doc); } + + FilteredElementCollector collector = new FilteredElementCollector(doc); + IList dataStorageList = collector.OfClass(typeof(DataStorage)).ToElements(); + + if (dataStorageList.Count > 0) + { + bool entityFound = false; + foreach (var ds in dataStorageList) + { + var existingEnt = ds.GetEntity(geoRefSchema); + if (existingEnt.IsValid()) + { + Field projectScaleField = geoRefSchema.GetField("EPSGCode"); + existingEnt.Set(projectScaleField, EPSGCode); + ds.SetEntity(existingEnt); + entityFound = true; + break; + } + } + if (!entityFound) + { + DataStorage geoRefStorage = DataStorage.Create(doc); + Entity ent = new Entity(geoRefSchema); + Field projectScaleField = geoRefSchema.GetField("EPSGCode"); + ent.Set(projectScaleField, EPSGCode, UnitTypeId.Custom); + geoRefStorage.SetEntity(ent); + } + } + else + { + DataStorage geoRefStorage = DataStorage.Create(doc); + Entity ent = new Entity(geoRefSchema); + Field projectScaleField = geoRefSchema.GetField("EPSGCode"); + ent.Set(projectScaleField, EPSGCode, UnitTypeId.Custom); + geoRefStorage.SetEntity(ent); + } + + trans.Commit(); + } + } + + public static Schema createHTWGeorefSchema(Document doc) + { + using (Transaction trans = new Transaction(doc, "create HTW Georef Schema")) + { + SchemaBuilder sb = new SchemaBuilder(Guid.NewGuid()); + sb.SetSchemaName("HTWDD_GeorefSchema"); + sb.SetReadAccessLevel(AccessLevel.Public); + sb.SetWriteAccessLevel(AccessLevel.Public); + + FieldBuilder fbScale = sb.AddSimpleField("ProjectScale", typeof(double)); + fbScale.SetSpec(SpecTypeId.Custom); + fbScale.SetDocumentation("Field stores project scale used for UTM coordinate calculations"); + + FieldBuilder fbEPSG = sb.AddSimpleField("EPSGCode", typeof(int)); + //fbEPSG.SetSpec(SpecTypeId.Custom); + fbEPSG.SetDocumentation("Field stores EPSG code of used CRS"); + + return sb.Finish(); + } + } + public static XYZ getProjectBasePointMeter(Document doc) { var projectBasePointFeet = BasePoint.GetProjectBasePoint(doc); @@ -103,6 +269,18 @@ public static double getProjectAngleDeg(Document doc) return projectPositionOrigin.Angle * 180 / System.Math.PI; } + public static Transform getGlobalToRevitTransform(Document doc) + { + var pbp_feet = BasePoint.GetProjectBasePoint(doc).SharedPosition; + var angle_rad = doc.ActiveProjectLocation.GetProjectPosition(XYZ.Zero).Angle; + + var trafoRot = Transform.CreateRotation(XYZ.BasisZ, -angle_rad); + var trafoTrans = Transform.CreateTranslation(-pbp_feet); + var trafo = trafoRot.Multiply(trafoTrans); + + return trafo; + } + public static List>> getSchemaAttributesForElement(Element element) { List>> schemaAndAttributeList = new List>>(); diff --git a/CommonRevit/BaseViewModel.cs b/CommonRevit/BaseViewModel.cs new file mode 100644 index 00000000..e042d486 --- /dev/null +++ b/CommonRevit/BaseViewModel.cs @@ -0,0 +1,18 @@ +using System.ComponentModel; +using System.Runtime.CompilerServices; + +namespace CommonRevit +{ + public abstract class BaseViewModel : INotifyPropertyChanged + { + public event PropertyChangedEventHandler PropertyChanged; + + protected virtual void RaisePropertyChanged([CallerMemberName] string propertyName = "") + { + if (!string.IsNullOrEmpty(propertyName)) + { + this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + } + } +} diff --git a/CommonRevit/CommonRevit.projitems b/CommonRevit/CommonRevit.projitems index acd4c45d..6caf564c 100644 --- a/CommonRevit/CommonRevit.projitems +++ b/CommonRevit/CommonRevit.projitems @@ -9,6 +9,8 @@ CommonRevit + + diff --git a/CommonRevit/DelegateCommand.cs b/CommonRevit/DelegateCommand.cs new file mode 100644 index 00000000..ea0f2852 --- /dev/null +++ b/CommonRevit/DelegateCommand.cs @@ -0,0 +1,30 @@ +using System; +using System.Windows.Input; + +namespace CommonRevit +{ + public class DelegateCommand : ICommand + { + readonly Action execute; + readonly Predicate canExecute; + + public DelegateCommand(Action execute, Predicate canExecute) + { + this.execute = execute; + this.canExecute = canExecute; + } + + public DelegateCommand(Action excute) : this(excute, null) { } + + public event EventHandler CanExecuteChanged; + + public void RaiseCanExecuteChanged() => this.CanExecuteChanged.Invoke(this, EventArgs.Empty); + + public bool CanExecute(object parameter) => true; + + public void Execute(object parameter) + { + this.execute?.Invoke(parameter); + } + } +}