private static ModelVisual3D BuildBlock(IFeature feature, double height) { var curve = new PointString(feature.GeoData); var mesh = Geometry3D.MeshBuilder.ExtrudeWithCaps(curve, height).ToMesh().ToWpfMesh(); var material = BlockScene.GetBlockMaterial(feature); var model = new GeometryModel3D(mesh, material) { BackMaterial = material }; return(new ModelVisual3D { Content = model }); }
private static ModelVisual3D BuildRoad(IFeature feature, double width) { var curve = new PointString(feature.GeoData); var mesh = MeshHelper.Road(new PointString(feature.GeoData), width); var material = BlockScene.GetRoadMaterial(feature); var model = new GeometryModel3D(mesh, material) { BackMaterial = material }; return(new ModelVisual3D { Content = model }); }
private void Init() { var basePaths = this.Map.Layers["地块"].Features; foreach (var feature in basePaths) { var height = 100d; //basePath["f"].TryParseToDouble() * FloorHeight; var block = BlockScene.BuildBlock(feature, height); this.Blocks.Add(block); this.Viewport.Children.Add(block); } var roadFeatures = this.Map.Layers["道路"].Features; foreach (var feature in roadFeatures) { var width = 30d; var road = BlockScene.BuildRoad(feature, width); this.Roads.Add(road); this.Viewport.Children.Add(road); } this.Viewport.ZoomExtents(); }