# import bpy
# import time
# import random
# import math
# import pickle
# # from .general import DirectionalPoint2d, Rect2d, DirectionalPoints2dCollection
# # from ..utils import définirPixel
# from bpy.types import Node
# from . import Node
#
#
# class CityDefNodeAddMapSocketOperator(bpy.types.Operator):
# 	bl_idname = 'node.city_def_node_add_map_socket'
# 	bl_label = 'Add map'
# 	bl_description = 'Add a map to the city'
# 	source_node_path = bpy.props.StringProperty()
#
# 	def execute(self, context):
# 		source_node = eval(self.source_node_path)
# 		random_string = time.time()
# 		source_node.inputs.new('OptionalMapSocket', str(random_string))
# 		return {'FINISHED'}
#
#
# class CityDefNode(Node, Node):
# 	bl_label = 'City definition'
# 	grid_size = bpy.props.IntProperty(
# 		name='Grid size',
# 		description='',
# 		default=100,
# 		min=1)
# 	cell_size_meters = bpy.props.IntProperty(
# 		name='Cell size (meters)',
# 		description='',
# 		default=10,
# 		min=1)
# 	pickled_building = bpy.props.StringProperty()
#
# 	def init(self, context):
# 		self.width = 300
# 		self.outputs.new('CityDefSocket', 'City def')
#
# 	def draw_buttons(self, context, layout):
# 		row = layout.row()
# 		row.prop(self, 'grid_size')
# 		row = layout.row()
# 		row.prop(self, 'cell_size_meters')
# 		# row = layout.row()
# 		# row.prop(self, 'custom_choice_condition')
# 		row = layout.row()
# 		side_length_meters = self.grid_size * self.cell_size_meters
# 		if side_length_meters < 1000:
# 			text = '{}m'.format(side_length_meters)
# 		else:
# 			text = '{}km'.format(side_length_meters / 1000)
# 		row.label(text='City side length: {}'.format(text))
# 		row = layout.row()
# 		area_size_square_km = round((side_length_meters / 1000) ** 2, 2)
# 		row.label(text='City area: {}km²'.format(area_size_square_km))
# 		row = layout.row()
# 		op = row.operator('node.city_def_node_add_map_socket')
# 		op.source_node_path = 'bpy.data.node_groups["' + self.id_data.name + '"].' + self.path_from_id()
#
# 	def update(self):
# 		pass
