Go to the documentation of this file.
36 m_keepAspectRatio =
true;
37 m_limitVisibleRange =
false;
69 m_mapView->
draw(m_mapRect);
75 m_mapView->
move(x, y);
80 m_zoom = stdext::clamp<int>(zoom, m_maxZoomIn, m_maxZoomOut);
81 updateVisibleDimension();
88 if(m_zoom - delta < m_maxZoomIn)
91 if(m_zoom - delta < m_maxZoomIn)
95 updateVisibleDimension();
102 if(m_zoom + delta > m_maxZoomOut)
105 if(m_zoom + delta > m_maxZoomOut)
109 updateVisibleDimension();
116 m_aspectRatio = visibleDimension.
ratio();
118 if(m_keepAspectRatio)
124 m_keepAspectRatio =
enable;
135 Point relativeMousePos = mousePos - m_mapRect.
topLeft();
165 if(node->tag() ==
"multifloor")
167 else if(node->tag() ==
"auto-view-mode")
169 else if(node->tag() ==
"draw-texts")
171 else if(node->tag() ==
"draw-lights")
173 else if(node->tag() ==
"animated")
184 void UIMap::updateVisibleDimension()
186 int dimensionHeight = m_zoom;
188 float ratio = m_aspectRatio;
189 if(!m_limitVisibleRange && !m_mapRect.
isEmpty() && !m_keepAspectRatio)
192 if(dimensionHeight % 2 == 0)
193 dimensionHeight += 1;
194 int dimensionWidth = m_zoom * ratio;
195 if(dimensionWidth % 2 == 0)
200 if(m_keepAspectRatio)
204 void UIMap::updateMapSize()
208 if(m_keepAspectRatio) {
210 mapSize =
Size(m_aspectRatio*m_zoom, m_zoom);
216 m_mapRect.
resize(mapSize);
220 if(!m_keepAspectRatio)
221 updateVisibleDimension();
bool contains(const TPoint< T > &p, bool insideOnly=false) const
virtual void setColor(const Color &color)
void resize(const TSize< T > &size)
void setKeepAspectRatio(bool enable)
int getCachedFirstVisibleFloor()
void scale(const TSize< T > &s, Fw::AspectRatioMode mode)
void setAutoViewMode(bool enable)
const TilePtr & getTile(const Position &pos)
Position getPosition(const Point &point, const Size &mapSize)
void removeMapView(const MapViewPtr &mapView)
stdext::shared_object_ptr< MapView > MapViewPtr
void addMapView(const MapViewPtr &mapView)
void movePixels(int x, int y)
TPoint< T > topLeft() const
void setVisibleDimension(const Size &visibleDimension)
void setMultifloor(bool enable)
TRect< T > expanded(T add) const
virtual void drawBoundingRect(const Rect &dest, int innerLineWidth=1)=0
TilePtr getTile(const Point &mousePos)
void moveCenter(const TPoint< T > &p)
void setDrawLights(bool enable)
bool coveredDown(int n=1)
void setAnimated(bool enable)
virtual void onStyleApply(const std::string &styleName, const OTMLNodePtr &styleNode)
virtual void onGeometryChange(const Rect &oldRect, const Rect &newRect)
Size getVisibleDimension()
void draw(const Rect &rect)
void drawSelf(Fw::DrawPane drawPane)
void optimizeForSize(const Size &visibleSize)
void setVisibleDimension(const Size &visibleDimension)
virtual void drawFilledRect(const Rect &dest)=0
TPoint< T > center() const
Size getVisibleDimension()
void setDrawTexts(bool enable)