Merge pull request #12 from senaduka/building-outline-inverted
outline fix
This commit is contained in:
@@ -285,12 +285,11 @@ def array_summary():
|
|||||||
context['summary_values'] = calculator.summary_values()
|
context['summary_values'] = calculator.summary_values()
|
||||||
|
|
||||||
panels = calculator.get_computed_csv_columns()
|
panels = calculator.get_computed_csv_columns()
|
||||||
|
max_y = project_presenter.get_max_y(calculator.buildings_for_drawing,panels)
|
||||||
context['panel_array'] = project_presenter.get_panel_data(panels,
|
context['panel_array'] = project_presenter.get_panel_data(panels,
|
||||||
calculator.subarrays,
|
calculator.subarrays,
|
||||||
project_presenter.get_max_y(
|
max_y)
|
||||||
calculator.buildings_for_drawing,
|
context['buildings'] = project_presenter.get_buildings(calculator.buildings_for_drawing, max_y)
|
||||||
panels))
|
|
||||||
context['buildings'] = project_presenter.get_buildings(calculator.buildings_for_drawing)
|
|
||||||
context['override_form'] = True
|
context['override_form'] = True
|
||||||
context['cad_file_name'] = session_manager.site.cad_file_name or 'Upload System Text Data'
|
context['cad_file_name'] = session_manager.site.cad_file_name or 'Upload System Text Data'
|
||||||
context['dxf_file_name'] = session_manager.site.dxf_file_name or 'Upload System DXF'
|
context['dxf_file_name'] = session_manager.site.dxf_file_name or 'Upload System DXF'
|
||||||
|
|||||||
@@ -50,9 +50,10 @@ class ProjectPresenter(object):
|
|||||||
self.offset = height
|
self.offset = height
|
||||||
for panel in table_data:
|
for panel in table_data:
|
||||||
panel['y'] = height - panel['y'] + first_cell
|
panel['y'] = height - panel['y'] + first_cell
|
||||||
|
|
||||||
return table_data
|
return table_data
|
||||||
|
|
||||||
def get_buildings(self, buildings):
|
def get_buildings(self, buildings, max_y):
|
||||||
if self.offset is None:
|
if self.offset is None:
|
||||||
self.offset = 0
|
self.offset = 0
|
||||||
|
|
||||||
@@ -67,7 +68,7 @@ class ProjectPresenter(object):
|
|||||||
# origin = self.find_origin(building)
|
# origin = self.find_origin(building)
|
||||||
for point in building:
|
for point in building:
|
||||||
point.x = point.x * spacing_x
|
point.x = point.x * spacing_x
|
||||||
point.y = point.y * spacing_y
|
point.y = abs((point.y * spacing_y - max_y))
|
||||||
presentable_building.append(point.__dict__)
|
presentable_building.append(point.__dict__)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -66,14 +66,14 @@ class PanelPresenterTest(unittest.TestCase):
|
|||||||
|
|
||||||
def test_get_buildings_data(self):
|
def test_get_buildings_data(self):
|
||||||
self.subject = ProjectPresenter(SystemType.singleTilt, ModuleType.Cell96)
|
self.subject = ProjectPresenter(SystemType.singleTilt, ModuleType.Cell96)
|
||||||
buildings = [ [ Coordinate(-60,-60), Coordinate(60,-60), Coordinate(60,60), Coordinate(-60,60) ] ] # big square
|
buildings = [ [ Coordinate(0,0), Coordinate(60,0), Coordinate(60,60), Coordinate(0,60) ] ] # big square
|
||||||
expected_buildings = [[
|
expected_buildings = [[
|
||||||
{'x': -60, '_Coordinate__rounded_x': -60, 'y': -60, '_Coordinate__rounded_y': -60, 'rotation': 0.0},
|
{'x': 0, '_Coordinate__rounded_x': 0, 'y': 60, '_Coordinate__rounded_y': 0, 'rotation': 0.0},
|
||||||
{'x': 60, '_Coordinate__rounded_x': 60, 'y': -60, '_Coordinate__rounded_y': -60, 'rotation': 0.0},
|
{'x': 60, '_Coordinate__rounded_x': 60, 'y': 60, '_Coordinate__rounded_y': 0, 'rotation': 0.0},
|
||||||
{'x': 60, '_Coordinate__rounded_x': 60, 'y': 60, '_Coordinate__rounded_y': 60, 'rotation': 0.0},
|
{'x': 60, '_Coordinate__rounded_x': 60, 'y': 0, '_Coordinate__rounded_y': 60, 'rotation': 0.0},
|
||||||
{'x': -60, '_Coordinate__rounded_x': -60, 'y': 60, '_Coordinate__rounded_y': 60, 'rotation': 0.0}
|
{'x': 0, '_Coordinate__rounded_x': 0, 'y': 0, '_Coordinate__rounded_y': 60, 'rotation': 0.0}
|
||||||
]]
|
]]
|
||||||
actual_buildings = self.subject.get_buildings(buildings)
|
actual_buildings = self.subject.get_buildings(buildings,60)
|
||||||
assert_array_equal(actual_buildings,expected_buildings)
|
assert_array_equal(actual_buildings,expected_buildings)
|
||||||
|
|
||||||
def test_get_max_y(self):
|
def test_get_max_y(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user