Example #1
0
        public void SetArea(GroundShapeInfo info, UpdatedTerrainTextures textures)
        {
            var overlappingElements = FindOverlappingGroundShapes(info);

            foreach (var element in overlappingElements)
            {
                if (element.GroundShapeInfo.Equals(info))
                {
                    // this is the same area! Dont do anything
                    return;
                }
                else
                {
                    _designBodySpotUpdaterProxy.RemoveTerrainTextures(element.TerrainId);
                    _groundTree.Remove(element.GlobalSubpositionEnvelope, element);
                }
            }
            var terrainTextureId =
                _designBodySpotUpdaterProxy.UpdateBodiesSpots(textures);
            var newElementInTree = new GroundShapeInfoInTree()
            {
                GroundShapeInfo = info,
                TerrainId       = terrainTextureId,
            };

            _groundTree.Insert(newElementInTree.GlobalSubpositionEnvelope, newElementInTree);
        }
Example #2
0
        private List <GroundShapeInfoInTree> FindOverlappingGroundShapes(GroundShapeInfo info)
        {
            var queryEnvelope       = MyNetTopologySuiteUtils.ToEnvelope(info.GlobalSubposition);
            var overlappingElements =
                _groundTree.Query(queryEnvelope)
                .Where(c => c.GlobalSubpositionEnvelope.Intersection(queryEnvelope).Area > 1)
                .ToList();

            return(overlappingElements);
        }
Example #3
0
 protected bool Equals(GroundShapeInfo other)
 {
     return(Equals(TextureCoords, other.TextureCoords) &&
            Equals(TextureGlobalPosition, other.TextureGlobalPosition) &&
            Equals(HeightmapResolution, other.HeightmapResolution));
 }
Example #4
0
 public GroundShapeToken AddArea(GroundShapeInfo info, UpdatedTerrainTextures textures)
 {
     return(new GroundShapeToken(this, info, textures));
 }
Example #5
0
 public GroundShapeToken(GRingSpotUpdater updater, GroundShapeInfo info, UpdatedTerrainTextures textures)
 {
     _updater  = updater;
     _info     = info;
     _textures = textures;
 }