ThinkGeo.com    |     Documentation    |     Premium Support

Rotation rectangle

                     RectangleShape RectangleShape1 = new EllipseShape(new PointShape(model.lot, model.lat), (double)2, GeographyUnit.DecimalDegree, DistanceUnit.NauticalMile).GetBoundingBox();  // 5 rectangle


                    el.Add(new Ppoint() { a = RectangleShape1, b = model.fish });



                    RectangleShape RectangleShape2 = new EllipseShape(new PointShape(model.lot, model.lat), (double)2, GeographyUnit.DecimalDegree, DistanceUnit.NauticalMile).GetBoundingBox();
                    RectangleShape2.TranslateByDegree(4, 0, GeographyUnit.DecimalDegree, DistanceUnit.NauticalMile);
                    el.Add(new Ppoint() { a = RectangleShape2, b = model.fish * (float)0.8 });  // 6 rectangle



                    RectangleShape RectangleShape3 = new EllipseShape(new PointShape(model.lot, model.lat), (double)2, GeographyUnit.DecimalDegree, DistanceUnit.NauticalMile).GetBoundingBox();
                    RectangleShape3.TranslateByDegree(4, 90, GeographyUnit.DecimalDegree, DistanceUnit.NauticalMile);
                    el.Add(new Ppoint() { a = RectangleShape3, b = model.fish * (float)0.8 });  // 8 rectangle



                    RectangleShape RectangleShape4 = new EllipseShape(new PointShape(model.lot, model.lat), (double)2, GeographyUnit.DecimalDegree, DistanceUnit.NauticalMile).GetBoundingBox();
                    RectangleShape4.TranslateByDegree(4, 180, GeographyUnit.DecimalDegree, DistanceUnit.NauticalMile);
                    el.Add(new Ppoint() { a = RectangleShape4, b = model.fish * (float)0.8 });  // 4 rectangle



                    RectangleShape RectangleShape5 = new EllipseShape(new PointShape(model.lot, model.lat), 2, GeographyUnit.DecimalDegree, DistanceUnit.NauticalMile).GetBoundingBox();
                    RectangleShape5.TranslateByDegree(4, 270, GeographyUnit.DecimalDegree, DistanceUnit.NauticalMile);
                    el.Add(new Ppoint() { a = RectangleShape5, b = model.fish * (float)0.8 });  // 2 rectangle
 
 
How i can add 1, 3, 7, 9 rectangle ???
 
 

RectangleShape1.TranslateByDegree(5.656, 45, GeographyUnit.DecimalDegree, DistanceUnit.NauticalMile); // 3 rectangle

 RectangleShape RectangleShape6 = new EllipseShape(new PointShape(model.lot, model.lat), 2, GeographyUnit.DecimalDegree, DistanceUnit.NauticalMile).GetBoundingBox(); 

 RectangleShape6.TranslateByDegree(Math.Sqrt(32), 45, GeographyUnit.DecimalDegree, DistanceUnit.NauticalMile); 

el.Add(new Ppoint() { a = RectangleShape6, b = model.fish * (float)0.6 }); 



RectangleShape RectangleShape7 = new EllipseShape(new PointShape(model.lot, model.lat), 2, GeographyUnit.DecimalDegree, DistanceUnit.NauticalMile).GetBoundingBox(); 

 RectangleShape7.TranslateByDegree(Math.Sqrt(32), 135, GeographyUnit.DecimalDegree, DistanceUnit.NauticalMile); 

el.Add(new Ppoint() { a = RectangleShape7, b = model.fish * (float)0.6 }); 



RectangleShape RectangleShape8 = new EllipseShape(new PointShape(model.lot, model.lat), 2, GeographyUnit.DecimalDegree, DistanceUnit.NauticalMile).GetBoundingBox(); 

 RectangleShape8.TranslateByDegree(Math.Sqrt(32), 225, GeographyUnit.DecimalDegree, DistanceUnit.NauticalMile); 

el.Add(new Ppoint() { a = RectangleShape8, b = model.fish * (float)0.6 }); 



RectangleShape RectangleShape9 = new EllipseShape(new PointShape(model.lot, model.lat), 2, GeographyUnit.DecimalDegree, DistanceUnit.NauticalMile).GetBoundingBox(); 

 RectangleShape9.TranslateByDegree(Math.Sqrt(32), 315, GeographyUnit.DecimalDegree, DistanceUnit.NauticalMile); 

el.Add(new Ppoint() { a = RectangleShape9, b = model.fish * (float)0.6 });
 

?



 1, 4, 6, 9  double insert, uou know why ?




 There must be some part you added them twice, here is my code and result.



        private void AddNewRectangle(int distance, int degrees, InMemoryFeatureLayer layer)
        {
            RectangleShape rect = new RectangleShape(-5, 5, 5, -5);
            rect.TranslateByDegree(distance, degrees, GeographyUnit.DecimalDegree, DistanceUnit.Mile);
            layer.InternalFeatures.Add(new Feature(rect));
        }

RectangleShape rect = new RectangleShape(-5, 5, 5, -5);
InMemoryFeatureLayer layer = new InMemoryFeatureLayer();
layer.InternalFeatures.Add(new Feature(rect));
layer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(50, GeoColor.StandardColors.Green));
layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

AddNewRectangle(1200, 45, layer);
AddNewRectangle(1200, 135, layer);
AddNewRectangle(1200, 225, layer);
AddNewRectangle(1200, 315, layer);
AddNewRectangle(848, 0, layer);
AddNewRectangle(848, 90, layer);
AddNewRectangle(848, 180, layer);
AddNewRectangle(848, 270, layer);


 



Regards,


Edgar