def layer_info(slpk): """ Layer information JSON """ if slpk not in slpks: #Get 404 if slpk doesn't exists abort(404, "Can't found SLPK: %s" % slpk) SceneLayerInfo = json.loads(read("3dSceneLayer.json.gz", slpk)) response.content_type = 'application/json' return json.dumps(SceneLayerInfo)
def geometry_info(slpk, layer, node): """ Geometry information bin """ if slpk not in slpks: #Get 404 if slpk doesn't exists abort(404, "Can't found SLPK: %s" % slpk) response.content_type = 'application/octet-stream; charset=binary' response.content_encoding = 'gzip' return read("nodes/%s/geometries/0.bin.gz" % node, slpk)
def feature_info(slpk, layer, node): """ Feature information JSON """ if slpk not in slpks: #Get 404 if slpk doesn't exists abort(404, "Can't found SLPK: %s" % slpk) FeatureData = json.loads(read("nodes/%s/features/0.json.gz" % node, slpk)) response.content_type = 'application/json' return json.dumps(FeatureData)
def carte(slpk): """ Preview data on a 3d globe """ if slpk not in slpks: #Get 404 if slpk doesn't exists abort(404, "Can't found SLPK: %s" % slpk) return template('carte', slpk=slpk, url="http://%s:%s/%s/SceneServer/layers/0" % (host, port, slpk))
def Ctextures_info(slpk, layer, node): """ Compressed texture information """ if slpk not in slpks: #Get 404 if slpk doesn't exists abort(404, "Can't found SLPK: %s" % slpk) try: return read("nodes/%s/textures/0_0_1.bin.dds.gz" % node, slpk) except: return ""
def node_info(slpk, layer, node): """ Node information JSON """ if slpk not in slpks: #Get 404 if slpk doesn't exists abort(404, "Can't found SLPK: %s" % slpk) NodeIndexDocument = json.loads( read("nodes/%s/3dNodeIndexDocument.json.gz" % node, slpk)) response.content_type = 'application/json' return json.dumps(NodeIndexDocument)
def textures_info(slpk, layer, node): """ Texture information JPG """ if slpk not in slpks: #Get 404 if slpk doesn't exists abort(404, "Can't found SLPK: %s" % slpk) try: return read("nodes/%s/textures/0_0.jpg" % node, slpk) except: return ""
def shared_info(slpk, layer, node): """ Shared node information JSON """ if slpk not in slpks: #Get 404 if slpk doesn't exists abort(404, "Can't found SLPK: %s" % slpk) try: Sharedressource = json.loads( read("nodes/%s/shared/sharedResource.json.gz" % node, slpk)) response.content_type = 'application/json' return json.dumps(Sharedressource) except: return ""
def textures_info(slpk, layer, node): """ Texture information JPG """ if slpk not in slpks: #Get 404 if slpk doesn't exists abort(404, "Can't found SLPK: %s" % slpk) response.headers['Content-Disposition'] = 'attachment; filename="0_0.jpg"' response.content_type = 'image/jpeg' try: return read("nodes/%s/textures/0_0.jpg" % node, slpk) except: try: return read("nodes/%s/textures/0_0.bin" % node, slpk) except: return ""
def service_info(slpk): """ Service information JSON """ if slpk not in slpks: #Get 404 if slpk doesn't exists abort(404, "Can't found SLPK: %s" % slpk) SceneServiceInfo = dict() SceneServiceInfo["serviceName"] = slpk SceneServiceInfo["name"] = slpk SceneServiceInfo["currentVersion"] = 10.6 SceneServiceInfo["serviceVersion"] = "1.6" SceneServiceInfo["supportedBindings"] = ["REST"] SceneServiceInfo["layers"] = [ json.loads(read("3dSceneLayer.json.gz", slpk)) ] response.content_type = 'application/json' return json.dumps(SceneServiceInfo)
def attribute_info(slpk, layer, node, attribute): """ Attribute information JSON """ if slpk not in slpks: #Get 404 if slpk doesn't exists abort(404, "Can't found SLPK: %s" % slpk) return read("nodes/%s/attributes/%s/0.bin.gz" % (node, attribute), slpk)
def geometry_info(slpk, layer, node): """ Geometry information bin """ if slpk not in slpks: #Get 404 if slpk doesn't exists abort(404, "Can't found SLPK: %s" % slpk) return read("nodes/%s/geometries/0.bin.gz" % node, slpk)