Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

map.expand(direction) added

  • Loading branch information...
commit 209e94ab951aa12ab24131282b5274c24fab8105 1 parent deff327
@baudvix authored
Showing with 39 additions and 2 deletions.
  1. +20 −0 mcc/model/map.py
  2. +19 −2 mcc/view/view_wx.py
View
20 mcc/model/map.py
@@ -201,6 +201,26 @@ def _add_map_section(self, offset_x, offset_y):
raise ValueError("Can't add MapSection with this offset - \
position is occupied.")
+ def expand_map(self, direction):
+ """
+ 0 - top
+ 1 - left
+ 2 - bottom
+ 3 - right
+ """
+ if direction == 0:
+ with self._lock:
+ self._add_map_section(0, self.expand[0] + 1)
+ elif direction == 1:
+ with self._lock:
+ self._add_map_section(self.expand[1] + 1, 0)
+ elif direction == 2:
+ with self._lock:
+ self._add_map_section(0, (self.expand[2] + 1) * -1)
+ elif direction == 3:
+ with self._lock:
+ self._add_map_section((self.expand[3] + 1) * -1, 0)
+
def get_point(self, x_coord, y_coord):
"""
Returns the value of a given point and creates a map section, if
View
21 mcc/view/view_wx.py
@@ -8,6 +8,8 @@
from OpenGL.GLU import *
from OpenGL.GL import *
+from mcc.model import map
+
APP_EXIT = 1
@@ -69,7 +71,7 @@ def initUI(self):
# --- arrange Map Monitor Panel ---
mm_hbox.Add(c_panel, 0.3, wx.EXPAND | wx.LEFT, 20)
- #mm_hbox.Add(canvas, 1, wx.EXPAND | wx.ALL, 10)
+ #mm_hbox.Add(canvas, 1, wx.ALL, 10)
mm_hbox.Add(canvas)
mm_panel.SetSizer(mm_hbox)
self.test()
@@ -189,8 +191,9 @@ def __init__(self, parent, trace_active, map_active):
wx.EVT_PAINT(self, self.on_draw)
wx.EVT_SIZE(self, self.on_size)
wx.EVT_WINDOW_DESTROY(self, self.on_destroy)
- self.SetSize((1067, 981))
+ self.SetSize((980, 980))
+ self._map_draw = map.MapModel('drawable map')
self.trace_active = trace_active
self.map_active = map_active
self._unit = 0.0125
@@ -230,6 +233,20 @@ def fset_zoom_factor(self, value):
self._zoom_factor = value
zoom_factor = property(fget_zoom_factor, fset_zoom_factor)
+ def update_points(self, points):
+ self._map_draw(points)
+
+
+ def map_propotional(self):
+ expand = self._map_draw
+ t, r, b, l = expand
+ while (t + b) < (r + l):
+ self._map_draw.expand_map(2)
+ b += 1
+ while (r + l) < (t + b):
+ self._map_draw.expand_map(1)
+ r += 1
+
def draw_lines(self, lines):
glBegin(GL_LINES)
for line in lines:
Please sign in to comment.
Something went wrong with that request. Please try again.