Esempio n. 1
0
    def generate_item_3d_monument(self, item_2d):
        coords = item_2d.geom.coords[0]
        #oriented_point = ddd.snap.project(ddd.point(coords), self.osm.ways_2d['0'])
        item_name = item_2d.extra['osm:feature']['properties'].get(
            'name', None)
        if item_name:
            if item_2d.extra.get('osm:artwork_type', None) == 'statue':
                item_3d = urban.sculpture_text(item_name[:1], 2.0, 5.0)
            else:
                # Try
                names = " ".join(self.item_names_all(item_2d))
                item_3d = iconitems.iconitem_auto(names, (2.0, 4.0), 0.8, 0.1)
                if not item_3d:
                    item_3d = urban.sculpture_text(item_name[:1], 2.0, 5.0)
                else:
                    item_3d = item_3d.translate([0, 0, 0.2])

        else:
            item_3d = urban.sculpture(2.0, 5.0)
        item_3d = urban.pedestal(item_3d, 2.0)
        item_3d = item_3d.rotate(
            [0, 0, item_2d.get('ddd:angle', 0) - math.pi / 2])
        item_3d = item_3d.translate([coords[0], coords[1],
                                     0.0]).material(ddd.mats.bronze)
        item_3d.name = 'Monument: %s' % item_2d.name
        return item_3d
Esempio n. 2
0
def periodictable_pilars2(root, obj):
    """
    Create a pilar for each element.

    - Position according to periodic table.
    - Letter size according to importance
    - Order according to discovery/synthesis

    - Atom on column (same height, must be easy to see)
    - Nucleus and electrons in orbitals / layers (maybe both models, one 2D smaller) - Rotating
    """
    logger.info("Creating: %s", obj)

    if not (obj.extra['element:group'] and obj.extra['element:period']):
        logger.info("Ignoring element (no group or period): %s", obj)
        return

    symbol = urban.sculpture_text(obj.extra['element:symbol'], 1.75, 3)

    #lamppost = urban.lamppost()
    #tree =

    item = obj.copy3()
    item.append(symbol)
    #item = item.translate((obj.geom.coords[0][0], obj.geom.coords[0][1], 0))

    root.find("/Elements3").append(item)
Esempio n. 3
0
File: items.py Progetto: c3ypt1c/ddd
 def generate_item_3d_monument(self, item_2d):
     # Todo: Use fountain shape if available, instead of centroid
     coords = item_2d.geom.coords[0]
     #oriented_point = ddd.snap.project(ddd.point(coords), self.osm.ways_2d['0'])
     item_name = item_2d.extra['osm:feature']['properties'].get(
         'name', None)
     if item_name:
         item_3d = urban.sculpture_text(item_name[:1], 2.0, 5.0)
     else:
         item_3d = urban.sculpture(2.0, 5.0)
     item_3d = urban.pedestal(item_3d, 2.0)
     item_3d = item_3d.rotate(
         [0, 0, item_2d.extra['ddd:angle'] - math.pi / 2])
     item_3d = item_3d.translate([coords[0], coords[1],
                                  0.0]).material(ddd.mats.bronze)
     item_3d.name = 'Monument: %s' % item_2d.name
     return item_3d
Esempio n. 4
0
item = urban.post_box()
items.append(item)

item = urban.lamppost()
items.append(item)

item = urban.busstop_small(text="Bus Stop")
items.append(item)

item = urban.bench()
items.append(item)

item = urban.sculpture()
items.append(item)

item = urban.sculpture_text("Test")
item = urban.pedestal(item)
items.append(item)

item = urban.sculpture_text("Monumental test string", vertical=True, height=12)
items.append(item)


item = urban.trafficlights()
#item = item.rotate([0, 0, (math.pi / 4) - math.pi / 2])
items.append(item)

item = urban.fountain()
items.append(item)

item = urban.wayside_cross()
Esempio n. 5
0
def pipeline_start(pipeline, root):

    ddd.mats.traffic_signs = ddd.material(
        name="TrafficSigns",
        color="#ffffff",  #color="#e01010",
        texture_path=ddd.DATA_DIR +
        "/materials/traffic-signs-es/traffic_signs_es_0.png",
        atlas_path=ddd.DATA_DIR +
        "/materials/traffic-signs-es/traffic_signs_es_0.plist")

    items = ddd.group3()

    item = urban.lamppost_high_mast()
    items.append(item)

    item = buildings.portal()
    #item = ddd.meshops.batch_by_material(item)
    items.append(item)
    #item.show()

    item = buildings.door()
    items.append(item)
    #item.show()

    item = buildings.window_with_border()
    items.append(item)

    item = common.bar_u()
    items.append(item)

    item = urban.waste_container_dome()
    items.append(item)

    item = urban.waste_container_with_lid_closed()
    items.append(item)

    item = urban.waste_container()
    items.append(item)

    item = landscape.ladder_pool()
    items.append(item)

    item = sports.golf_flag()
    items.append(item)

    item = urban.drinking_water()
    items.append(item)

    item = urban.bollard()
    items.append(item)

    item = urban.bell()
    items.append(item)

    item = urban.fire_hydrant()
    items.append(item)

    item = urban.childrens_playground_swingset()
    items.append(item)

    item = urban.childrens_playground_sandbox()
    items.append(item)

    item = urban.childrens_playground_slide()
    items.append(item)

    item = urban.childrens_playground_arc()
    items.append(item)

    item = urban.patio_table()
    items.append(item)

    item = urban.patio_chair()
    items.append(item)

    item = urban.patio_umbrella()
    items.append(item)

    item = urban.post_box()
    items.append(item)

    item = urban.lamppost()
    items.append(item)

    item = urban.busstop_small(text="Bus Stop")
    items.append(item)

    item = urban.bench()
    items.append(item)

    item = urban.sculpture()
    items.append(item)

    item = urban.sculpture_text("Test")
    item = urban.pedestal(item)
    items.append(item)

    item = urban.sculpture_text("Monumental test string",
                                vertical=True,
                                height=12)
    items.append(item)

    item = urban.trafficlights()
    #item = item.rotate([0, 0, (math.pi / 4) - math.pi / 2])
    items.append(item)

    item = urban.fountain()
    items.append(item)

    item = urban.wayside_cross()
    items.append(item)

    item = urban.trash_bin()
    items.append(item)

    item = urban.trash_bin_post()
    items.append(item)

    # Road signs
    item = urban.traffic_sign('stop')
    items.append(item)
    #item.show()
    item = urban.traffic_sign('give_way')
    items.append(item)
    #item.show()
    item = urban.traffic_sign('es:s13')
    items.append(item)
    #item.show()
    item = urban.traffic_sign('es:p1')
    items.append(item)
    item = urban.traffic_sign('es:r101')
    items.append(item)
    item = urban.traffic_sign('es:r1')
    items.append(item)
    item = urban.traffic_sign('es:r2')
    items.append(item)
    item = urban.traffic_sign('es:r3')
    items.append(item)
    item = urban.traffic_sign('es:r6')
    items.append(item)
    item = urban.traffic_sign('es:r402')
    items.append(item)
    item = urban.traffic_sign('es:r500')
    items.append(item)
    item = urban.traffic_sign('es:r504')
    items.append(item)
    #item = urban.traffic_sign('es:r505-b')
    #items.append(item)
    item = urban.traffic_sign('es:r505')
    items.append(item)
    item = urban.traffic_sign('es:r506')
    items.append(item)

    #item.show()
    '''
    # Reduced
    items_org = items.copy()

    items = ddd.meshops.reduce(items_org)

    items = ddd.align.grid(items)
    items.append(ddd.helper.all())
    items.show()

    items = ddd.meshops.reduce_bounds(items_org)

    items = ddd.align.grid(items)
    items.append(ddd.helper.all())
    items.show()
    '''

    items = ddd.align.grid(items)
    items.append(ddd.helper.all())
    #items.show()
    #items.save("/tmp/test.glb")

    #items = ddd.meshops.batch_by_material(items)
    #items.dump()
    items.show()
    #items.save("/tmp/test.json")

    pipeline.root = items