DE:Historic.Place/Übersetzungen/Popup/TemplateJS

From OpenStreetMap Wiki
Jump to navigation Jump to search

broom

Dieser Artikel oder Abschnitt kann veraltete Informationen enthalten. Enthaltene Informationen können nicht mehr korrekt oder nicht weiter von Bedeutung sein.
Wenn du aktuelle Informationen beitragen kannst, hilf bitte bei der Aktualisierung oder teile diese auf der Diskussionsseite mit. (Discussion)

JS-Code

//==============================================================================
//
//        Erzeugt eine Kurzbeschreibung zu einem Objekt
//
//==============================================================================
function infoFromData(data) {
    var classes = [];
    var types = [];
    //------------------------------------------------------
    //        Attribute
    //------------------------------------------------------
    var ruins = (data.ruins == 'yes');
    var disused = (data.disused == 'yes');
    var abandoned = !!data.abandoned;
    var protected = false;
    //------------------------------------------------------
    //        heritage=1
    //------------------------------------------------------
    switch (data.heritage) {
    case '1':
        classes.push();
        break;
    case 'yes':
    case '2':
    case '3':
    case '4':
    case '5':
    case '6':
    case '7':
    case '8':
    case '9':
        protected = true;
        break;
    }
    //------------------------------------------------------
    //        man_made
    //------------------------------------------------------
    switch (data.man_made) {
    case 'adit':
        types.push();
        break;
    case 'mineshaft':
        types.push();
        break;
    case 'windmill':
        types.push();
        break;
    case 'watermill':
        types.push();
        break;
    }
    //------------------------------------------------------------
    //        natural
    //------------------------------------------------------------
    switch (data.natural) {
    case 'tree':
        types.push();
        break;
    case 'stone':
        types.push();
        break;
    case 'spring':
        types.push();
        break;
    }
    //------------------------------------------------------------
    //        monastery
    //------------------------------------------------------------
    if (data.building == 'monastery' ||
	    data.amenity == 'monastery' ||
		data.historic == 'monastery') {
        types.push();
    }
    //------------------------------------------------------------
    //        historic
    //------------------------------------------------------------
    switch (data.historic) {
    case 'aircraft':
        types.push();
        break;
    case 'archaeological_site':
        switch (data.site_type) {
        case 'megalith':
            switch (data.megalith_type) {
            case 'menhir':
                types.push();
                break;
            case 'grosssteingrab':
                types.push();
                break;
            case 'passage_grave':
                types.push();
                break;
            case 'stone_circle':
                types.push();
                break;
            case 'alignment':
                types.push();
                break;
            case 'chamber':
                types.push();
                break;
            default:
                types.push();
                break;
            }
            break;
        case 'tumulus':
            types.push();
            break;
        case 'fortification':
            types.push();
            break;
        default:
            types.push();
            break;
        }
        break;
    case 'battlefield':
        types.push();
        break;
    case 'boundary_stone':
        types.push();
        break;
    case 'building':
        types.push();
        break;
    case 'castle':
        switch (data.castle_type) {
        case 'defensive':
            types.push();
            break;
        case 'fort':
            types.push();
            break;
        case 'fortress':
            types.push();
            break;
        case 'kremlin':
            types.push();
            break;
        case 'manor':
            types.push();
            break;
        case 'palace':
            types.push();
            break;
        case 'shiro':
            types.push();
            break;
        case 'stately':
            types.push();
            break;
        default:
            types.push();
            break;
        }
        break;
    case 'city_gate':
        types.push();
        break;
    case 'city_wall':
    case 'citywalls':
        types.push();
        break;
    case 'farm':
        types.push();
        break;
    case 'fort':
        types.push();
        break;
    case 'fortress':
        types.push();
        break;
    case 'gallows':
        types.push();
        break;
    case 'kremlin':
        types.push();
        break;
    case 'manor':
        types.push();
        break;
    case 'memorial':
        switch (data['memorial:type']) {
        case 'stolperstein':
            types.push();
            break;
        }
        switch (data['memorial:type']) {
        case 'plate':
            types.push();
            break;
        default:
            types.push();
            break;
        }
        break;
    case 'milestone':
        types.push();
        break;
    case 'mine':
        types.push();
        break;
    case 'monastery':
        types.push();
        break;
    case 'monument':
        types.push();
        break;
    case 'palace':
        types.push();
        break;
    case 'protected_building':
        types.push();
        break;
    case 'railway':
        types.push();
        break;
    case 'railway_station':
        types.push();
        break;
    case 'ruins':
        ruins = true;
        break;
    case 'rune_stone':
        types.push();
        break;
    case 'ruins':
        ruins = true;
        break;
    case 'rune_stone':
        types.push();
        break;
    case 'ship':
        types.push();
        break;
    case 'stone':
        switch (data['stone_type']) {
        case 'conciliation_cross':
            types.push();
            break;
        default:
            types.push();
            break;
        }
        break;
    case 'threshing_floor':
        types.push();
        break;
    case 'tomb':
        types.push();
        break;
    case 'quarry':
        types.push();
        break;
    case 'industrial':
        types.push();
        break;
    case 'cannon':
        types.push();
        break;
    case 'heritage':
        protected = true;
        break;
    case 'tower':
        types.push();
        break;
    case 'wayside_cross':
        types.push(data.natural == 'peak');
        break;
    case 'church':
        types.push();
        break;
    case 'chapel':
        types.push();
        break;
    case 'wayside_shrine':
        types.push();
        break;
    case 'wayside_chapel':
        types.push();
        break;
    case 'wreck':
        types.push();
        break;
    default:
        switch (data.description) {
        case 'technical_monument':
            types.push();
            break;
        }
        break;
        // "Historisches Objekt" wird weiter unten eingefügt
    }
    //------------------------------------------------------------
    //        railway:historic
    //------------------------------------------------------------
    switch (data['railway:historic']) {
    case 'rail':
        types.push();
        break;
    }
    //------------------------------------------------------------
    //        palaeontological_site
    //------------------------------------------------------------
    switch (data.geological) {
    case 'palaeontological_site':
        types.push();
        break;
    }
    //------------------------------------------------------------
    //        amenity
    //------------------------------------------------------------
    switch (data.amenity) {
    case 'place_of_worship':
        types.push();
        break;
    case 'fountain':
        types.push();
        break;
        
    case 'townhall':
        types.push();
        break;
    }
    //------------------------------------------------------------
    //        boundary
    //------------------------------------------------------------
    switch (data.boundary) {
    case 'marker':
        types.push();
        break;
    }
    //------------------------------------------------------------
    //        abandoned=village
    //------------------------------------------------------------
    switch (data.abandoned) {
    case 'village':
        types.push();
        abandoned = false;
        break;
    }
    //------------------------------------------------------------
    //        man_made
    //------------------------------------------------------------
    switch (data.man_made) {
    case 'survey_point':
        types.push();
        break;
    case 'water_well':
        if (data.pump) {
            switch (data.pump) {
            case 'manual':
                types.push();
                break;
            default:
                types.push();
                break;
            }
            break;
        }
        types.push();
        break;
    case 'tower':
        types.push();
        break;
    case 'water_tower':
        types.push();
        break;
    }
    //------------------------------------------------------------
    //        military 
    //------------------------------------------------------------
    switch (data.military) {
    case 'bunker':
        types.push();
        break;
    }
    //------------------------------------------------------------
    //        historic:railway
    //------------------------------------------------------------
    switch (data['historic:railway']) {
    case 'halt':
        types.push();
        break;
    case 'station':
        types.push();
        break;
    }
    //------------------------------------------------------------
    //        railway:historic
    //------------------------------------------------------------
    switch (data['railway:historic']) {
    case 'station_site':
        types.push();
        break;
    case 'station':
        types.push();
        break;
    }
    //------------------------------------------------------------
    //        landuse
    //------------------------------------------------------------
    switch (data['landuse']) {
    case 'quarry':
        types.push();
        break;
    }
    //------------------------------------------------------------
    //        summit:
    //------------------------------------------------------------
    if (data['summit:cross'] == 'yes') {
        types.push();
    }
    //------------------------------------------------------------
    //        information
    //------------------------------------------------------------
    switch (data['information']) {
    case 'board':
        types.push();
        break;
    }
    //------------------------------------------------------------
    //        Default types
    //------------------------------------------------------------
    if (types.length == 0 && data.building) {
        types.push();
    }
    if (types.length == 0) {
        types.push();
    }
    //------------------------------------------------------------
    //        Klassen
    //------------------------------------------------------------
    var result = [];
    if (classes.length > 0) {
        result.push(classes.join(', '));
        result.push(': ');
    }
    result.push(types.join(', '));
    //------------------------------------------------------------
    //        Attribute
    //------------------------------------------------------------
    var attributes = [];
    if (ruins) attributes.push();
    if (disused) attributes.push();
    if (abandoned) attributes.push();
    if (protected) attributes.push();
    if (attributes.length > 0) {
        result.push('(');
        result.push(attributes.join(', '));
        result.push(')');
    }
    //------------------------------------------------------------
    //        Result
    //------------------------------------------------------------