Example #1
0
from sqlalchemy.ext.mutable import MutableDict
from sqlalchemy.dialects.postgresql import HSTORE

from nextgisweb.models import declarative_base
from nextgisweb import db
from nextgisweb.resource import (
    Resource,
    ResourceScope,
    DataScope,
    Serializer,
    SerializedProperty,
    ResourceGroup)

from .util import _

Base = declarative_base()


class LookupTable(Base, Resource):
    identity = 'lookup_table'
    cls_display_name = _("Lookup table")

    __scope__ = DataScope

    val = db.Column(MutableDict.as_mutable(HSTORE))

    @classmethod
    def check_parent(self, parent):
        return isinstance(parent, ResourceGroup)

Example #2
0
from nextgisweb.feature_layer import (IFeatureLayer, GEOM_TYPE, on_data_change
                                      as on_data_change_feature_layer)
from nextgisweb.render import (
    IRenderableStyle,
    IExtentRenderRequest,
    ITileRenderRequest,
    ILegendableStyle,
    on_style_change,
    on_data_change as on_data_change_renderable,
)

from .mapfile import Map, mapfile, schema, registry

from .util import _

Base = declarative_base()

# Палитра из 12 цветов ColorBrewer
_RNDCOLOR = (
    (141, 211, 199),
    (255, 255, 179),
    (190, 186, 218),
    (251, 128, 114),
    (128, 177, 211),
    (253, 180, 98),
    (179, 222, 105),
    (252, 205, 229),
    (217, 217, 217),
    (188, 128, 189),
    (204, 235, 197),
    (255, 237, 111),