public virtual void PutOnMap(IDrawingSurface map, ITile iTile, IObjectsLayoutManager iOlm) { m_map = map; m_itile = iTile; m_olm = iOlm; // can be null m_pixelLocation = map.toPixelLocation(m_location, iTile); }
public override void PutOnMap(IDrawingSurface tileSet, ITile iTile, IObjectsLayoutManager olm) { base.PutOnMap(tileSet, iTile, olm); m_pixelLocationBottomLeft = tileSet.toPixelLocation(new GeoCoord(m_geoTiff.BottomLeftLng, m_geoTiff.BottomLeftLat), iTile); m_pixelLocationTopRight = tileSet.toPixelLocation(new GeoCoord(m_geoTiff.TopRightLng, m_geoTiff.TopRightLat), iTile); m_pixelLocationBottomRight = tileSet.toPixelLocation(new GeoCoord(m_geoTiff.BottomRightLng, m_geoTiff.BottomRightLat), iTile); boundingRect(); // make sure we have current values there }
public override void AdjustPlacement(IDrawingSurface map, ITile iTile, IObjectsLayoutManager iOlm) { if (m_bigCity > 0 || m_doName && m_intersections > 0) { //LibSys.StatusBar.Trace("AdjustPlacement(): City: - " + Location + " - " + Name + " int=" + m_intersections + " pos=" + m_labelPosition + " doName=" + m_doName); placeLabel(m_bigCity, m_fontSize, true); // may turn m_doName to false boundingRect(); // make sure we have current values there //LibSys.StatusBar.Trace(" int=" + m_intersections + " pos=" + m_labelPosition + " doName=" + m_doName); } }
public virtual int countIntersections(IObjectsLayoutManager iOlm, LiveObject lo, Rectangle rect) { if (iOlm != null) { return(iOlm.countIntersections(lo, rect)); } else { return(0); } }
public override void AdjustPlacement(IDrawingSurface map, ITile iTile, IObjectsLayoutManager olm) { if (m_intersections > 0) { #if DEBUG LibSys.StatusBar.Trace("AdjustPlacement(): Vehicle: - " + Location + " int=" + m_intersections + " pos=" + m_labelPosition + " doName=" + m_doName); #endif placeLabel(0, m_fontSize, true); // may turn m_doName to false boundingRect(); // make sure we have current values there //LibSys.StatusBar.Trace(" int=" + m_intersections + " pos=" + m_labelPosition + " doName=" + m_doName); } }
public override void PutOnMap(IDrawingSurface tileSet, ITile iTile, IObjectsLayoutManager olm) { base.PutOnMap(tileSet, iTile, olm); m_enabled = true; placeLabel(5, m_fontSize, false); // may turn m_doName to false boundingRect(); // make sure we have current values there //LibSys.StatusBar.Trace("Vehicle:PutOnMap(): veh - " + Location + m_pixelLocation + " - " + " BR=" + m_boundingRect + " LBR=" + m_labelBoundingRect + " int=" + m_intersections + " pos=" + m_labelPosition + " doName=" + m_doName); }
public void PutOnMap(IDrawingSurface layer, ITile iTile, IObjectsLayoutManager iOlm) { assignNames(layer); rebuildTrackBoundaries(); /* * can't do this, as other trackpoints are not placed and will not react on mouse hover * foreach(Waypoint wpt in m_trackpointsNamed) * { * wpt.PutOnMap(layer, iTile, iOlm); * } */ // keep the stepping logic in sync with WaypointsCache:RefreshWaypointsDisplayed(), because // LayerWaypoints:WaypointByPoint() operates on the WaypointsCache.WaypointsDisplayedNotSorted array int step = getStep(this, layer.getCameraElevation()); for (int i = 0; i < m_trackpoints.Count; i += step) { try { Waypoint wpt = (Waypoint)m_trackpoints.GetByIndex(i); if (wpt.ThumbImage != null) { i -= (step - 1); // move to the next trackpoint continue; } wpt.PutOnMap(layer, iTile, iOlm); int pointsLeft = m_trackpoints.Count - i; if (pointsLeft > 1 && pointsLeft < step) { step = pointsLeft - 2; if (step < 1) { step = 1; } } } catch {} } if (Project.thumbDoDisplay) { SortedList ppts = Project.mainCommand.getWaypointsWithThumbs(m_id); for (int i = 0; i < ppts.Count; i++) { Waypoint wpt = (Waypoint)ppts.GetByIndex(i); wpt.PutOnMap(layer, iTile, iOlm); } } }
public void PutOnMap(IDrawingSurface map, ITile iTile, IObjectsLayoutManager tile) { #if DEBUG LibSys.StatusBar.Trace("IP: Features:PutOnMap() " + m_list.Count + " " + tile); #endif // here is a slow and ineffective method to restore all live objects to original state. // it does not work on substitutes though: // m_list.Clear(); // this.Fill(); // if lo.init() works well, the loop below will do the job of Clear/Fill: foreach (LiveObject lo in m_list) { try { lo.init(true); } catch (Exception e) { LibSys.StatusBar.Error("Features:PutOnMap(): lo=" + lo + " " + e.Message); } } foreach (LiveObject lo in m_list) { try { lo.PutOnMap(map, iTile, tile); } catch (Exception e) { LibSys.StatusBar.Error("Features:PutOnMap(): lo=" + lo + " " + e.Message); } } foreach (LiveObject lo in m_list) { try { lo.AdjustPlacement(map, iTile, tile); } catch (Exception e) { LibSys.StatusBar.Error("Features:PutOnMap() - AdjustPlacement: lo=" + lo + " " + e.Message); } } m_hasPutOnMap = true; }
public override void PutOnMap(IDrawingSurface layer, ITile iTile, IObjectsLayoutManager olm) { base.PutOnMap(layer, iTile, olm); //m_doName = true; m_enabled = true; Name = getLabel(true); m_fontSize = fontSizeByType(LiveObjectType); placeLabel(0, m_fontSize, false); // may turn m_doName to false boundingRect(); // make sure we have current values there //LibSys.StatusBar.Trace("LabeledPoint:PutOnMap(): " + Location + m_pixelLocation + " BR=" + m_boundingRect + " LBR=" + m_labelBoundingRect + " int=" + m_intersections + " pos=" + m_labelPosition + " doName=" + m_doName); }
public override void PutOnMap(IDrawingSurface tileSet, ITile iTile, IObjectsLayoutManager tile) { base.PutOnMap(tileSet, iTile, tile); //LibSys.StatusBar.Trace("PutOnMap(): - " + this); m_pixelRadius = MIN_PLACE_PIXEL_RADIUS; m_enabled = true; int importance = Importance; string dsg = Dsg; m_placeCode = m_code; setColors(); // and doSize if (m_doName) { int bigPlace = (6 - importance); // 5-high, 0-low // font size will be calculated depending on population m_fontSize = Project.PLACE_FONT_SIZE; if (bigPlace > 0) { switch (bigPlace) { case 5: m_fontSize += 3; break; default: m_fontSize += bigPlace / 2; break; } } placeLabel(bigPlace, m_fontSize, false); } else { m_imageBoundingRect = Rectangle.Empty; } boundingRect(); // make sure we have current values there }
public override void PutOnMap(IDrawingSurface layer, ITile iTile, IObjectsLayoutManager olm) { base.PutOnMap(layer, iTile, olm); m_elevKm = layer.getCameraElevation() / 1000.0d; m_doFill = m_magn > 1.0d && (!Project.earthquakeStyleFillRecent || Project.localToZulu(DateTime.Now).AddMinutes(-recentTimes[Project.earthquakeStyleFillHowRecentIndex]) < this.DateTime); if (m_elevKm > 5000.0d) { m_doName = m_magn > 5.0d; } else if (m_elevKm > 2000.0d) { m_doName = m_magn > 4.0d; } else if (m_elevKm > 900.0d) { m_doName = m_magn > 3.0d; } else if (m_elevKm > 370.0d) { m_doName = m_magn > 1.0d; } else if (m_elevKm > 100.0d) { m_doName = m_magn > 0.0d; } else { m_doName = true; } m_enabled = true; Name = getLabel(true); placeLabel(0, m_fontSize, false); // may turn m_doName to false boundingRect(); // make sure we have current values there //LibSys.StatusBar.Trace("Earthquake:PutOnMap(): eq - " + Location + m_pixelLocation + " - " + Magn + " BR=" + m_boundingRect + " LBR=" + m_labelBoundingRect + " int=" + m_intersections + " pos=" + m_labelPosition + " doName=" + m_doName); }
public override void AdjustPlacement(IDrawingSurface map, ITile iTile, IObjectsLayoutManager olm) { //LibSys.StatusBar.Trace("LabeledPoint:AdjustPlacement(): - " + Location + " int=" + m_intersections + " pos=" + m_labelPosition + " doName=" + m_doName); if(m_intersections > 0) { //LibSys.StatusBar.Trace("LabeledPoint:AdjustPlacement(): - " + Location + " int=" + m_intersections + " pos=" + m_labelPosition + " doName=" + m_doName); placeLabel(0, m_fontSize, true); // may turn m_doName to false boundingRect(); // make sure we have current values there //LibSys.StatusBar.Trace(" int=" + m_intersections + " pos=" + m_labelPosition + " doName=" + m_doName); } }
public virtual void AdjustPlacement(IDrawingSurface map, ITile iTile, IObjectsLayoutManager tile) { }
public override void PutOnMap(IDrawingSurface layer, ITile iTile, IObjectsLayoutManager olm) { base.PutOnMap(layer, iTile, olm); m_elevKm = layer.getCameraElevation() / 1000.0d; m_doFill = m_magn > 1.0d && (!Project.earthquakeStyleFillRecent || Project.localToZulu(DateTime.Now).AddMinutes(-recentTimes[Project.earthquakeStyleFillHowRecentIndex]) < this.DateTime); if(m_elevKm > 5000.0d) { m_doName = m_magn > 5.0d; } else if(m_elevKm > 2000.0d) { m_doName = m_magn > 4.0d; } else if(m_elevKm > 900.0d) { m_doName = m_magn > 3.0d; } else if(m_elevKm > 370.0d) { m_doName = m_magn > 1.0d; } else if(m_elevKm > 100.0d) { m_doName = m_magn > 0.0d; } else { m_doName = true; } m_enabled = true; Name = getLabel(true); placeLabel(0, m_fontSize, false); // may turn m_doName to false boundingRect(); // make sure we have current values there //LibSys.StatusBar.Trace("Earthquake:PutOnMap(): eq - " + Location + m_pixelLocation + " - " + Magn + " BR=" + m_boundingRect + " LBR=" + m_labelBoundingRect + " int=" + m_intersections + " pos=" + m_labelPosition + " doName=" + m_doName); }
public override int countIntersections(IObjectsLayoutManager olm, LiveObject lo, Rectangle rect) { return olm.countIntersections(lo, rect); }
public override void PutOnMap(IDrawingSurface tileSet, ITile iTile, IObjectsLayoutManager iOlm) { base.PutOnMap(tileSet, iTile, iOlm); // font size will be calculated depending on population m_fontSize = Project.CITY_FONT_SIZE; //LibSys.StatusBar.Trace("PutOnMap(): City: - " + Location + " - " + Name); m_enabled = true; m_pixelRadius = MIN_CITY_PIXEL_RADIUS; if (m_dsg != null) { if (m_dsg.Equals("C")) { // capital of a country isCapital = true; m_bigCity = 5; } if (m_dsg.Equals("A")) { // capital of a state isStateCapital = true; m_bigCity = 4; } } // we somewhat cheat here to make sizes of important cities and capitals depend on their importance: if (m_population == 0) { if (m_dsg != null) { if (isCapital) { // capital of a country m_population = 5000000; } if (isStateCapital) { // capital of a state m_population = 1000000; } else { m_population = 50000; } } else { switch (m_importance) { case 1: // high m_population = 2000000; m_bigCity = Math.Max(5, m_bigCity); break; case 2: // kind of high m_population = 1000000; m_bigCity = Math.Max(4, m_bigCity); break; case 3: // average m_population = 500000; m_bigCity = Math.Max(2, m_bigCity); break; case 4: // rather low m_population = 100000; break; case 5: // low m_population = 50000; break; // non-important cities just stay with population = 0 } } } else { if (m_population >= 2000000) { m_bigCity = 5; } else if (m_population >= 1000000) { m_bigCity = 4; } } // end of population cheating if (m_doSize) { if (m_population != 0) { double sqMetersPerPerson = 100.0d; double radiusMeters = Math.Sqrt(sqMetersPerPerson * m_population / 3.14d); int rx = (int)(radiusMeters / m_map.xMetersPerPixel()); int ry = (int)(radiusMeters / m_map.yMetersPerPixel()); m_pixelRadius = (rx + ry) / 2; if (m_pixelRadius < (MIN_CITY_PIXEL_RADIUS + 2)) { m_pixelRadius = MIN_CITY_PIXEL_RADIUS + 2; } } // cities with 0 population stay at MIN_CITY_PIXEL_RADIUS } if (m_doName) { // we increase font size only if the city will be displayed // as a bigger circle on the map. Otherwise on a world map // the font will be unjustifiably large int delta = m_pixelRadius - MIN_CITY_PIXEL_RADIUS; if (delta > 0) { if (m_population > 800000) { m_fontSize += Math.Min(delta, 9); } else if (m_population > 400000) { m_fontSize += Math.Min(delta, 7); } else if (m_population > 150000) { m_fontSize += Math.Min(delta, 5); } else if (m_population > 50000) { m_fontSize += Math.Min(delta, 3); } else { m_fontSize += Math.Min(delta, 1); } } if (isCapital) { m_fontSize += 2; m_pixelRadius += 2; } else if (isStateCapital) { //m_fontSize += 2; //m_pixelRadius += 2; } /* * if(bigCity) { * LibSys.StatusBar.Trace("city=" + m_city.name() + " delta=" + delta + " font=" + m_fontSize); + } */ placeLabel(m_bigCity, m_fontSize, false); // may turn m_doName to false } else { labelBoundingRect(); // Empty } boundingRect(); // make sure we have current values there //LibSys.StatusBar.Trace("PutOnMap(): City: - " + Location + " - " + Name + " BR=" + m_boundingRect + " LBR=" + m_labelBoundingRect + " doName=" + m_doName); }
public virtual int countIntersections(IObjectsLayoutManager iOlm, LiveObject lo, Rectangle rect) { if(iOlm != null) { return iOlm.countIntersections(lo, rect); } else { return 0; } }
public void PutOnMap(IDrawingSurface layer, ITile iTile, IObjectsLayoutManager iOlm) { assignNames(layer); rebuildTrackBoundaries(); /* * can't do this, as other trackpoints are not placed and will not react on mouse hover foreach(Waypoint wpt in m_trackpointsNamed) { wpt.PutOnMap(layer, iTile, iOlm); } */ // keep the stepping logic in sync with WaypointsCache:RefreshWaypointsDisplayed(), because // LayerWaypoints:WaypointByPoint() operates on the WaypointsCache.WaypointsDisplayedNotSorted array int step = getStep(this, layer.getCameraElevation()); for(int i=0; i < m_trackpoints.Count ;i+=step) { try { Waypoint wpt = (Waypoint)m_trackpoints.GetByIndex(i); if(wpt.ThumbImage != null) { i -= (step - 1); // move to the next trackpoint continue; } wpt.PutOnMap(layer, iTile, iOlm); int pointsLeft = m_trackpoints.Count - i; if(pointsLeft > 1 && pointsLeft < step) { step = pointsLeft - 2; if(step < 1) { step = 1; } } } catch {} } if(Project.thumbDoDisplay) { SortedList ppts = Project.mainCommand.getWaypointsWithThumbs(m_id); for (int i=0; i < ppts.Count ;i++) { Waypoint wpt = (Waypoint)ppts.GetByIndex(i); wpt.PutOnMap(layer, iTile, iOlm); } } }
public override int countIntersections(IObjectsLayoutManager olm, LiveObject lo, Rectangle rect) { return(olm.countIntersections(lo, rect)); }
public void PutOnMap(IDrawingSurface map, ITile iTile, IObjectsLayoutManager tile) { #if DEBUG LibSys.StatusBar.Trace("IP: Features:PutOnMap() " + m_list.Count + " " + tile); #endif // here is a slow and ineffective method to restore all live objects to original state. // it does not work on substitutes though: // m_list.Clear(); // this.Fill(); // if lo.init() works well, the loop below will do the job of Clear/Fill: foreach(LiveObject lo in m_list) { try { lo.init(true); } catch(Exception e) { LibSys.StatusBar.Error("Features:PutOnMap(): lo=" + lo + " " + e.Message); } } foreach(LiveObject lo in m_list) { try { lo.PutOnMap(map, iTile, tile); } catch(Exception e) { LibSys.StatusBar.Error("Features:PutOnMap(): lo=" + lo + " " + e.Message); } } foreach(LiveObject lo in m_list) { try { lo.AdjustPlacement(map, iTile, tile); } catch(Exception e) { LibSys.StatusBar.Error("Features:PutOnMap() - AdjustPlacement: lo=" + lo + " " + e.Message); } } m_hasPutOnMap = true; }