How to use the jupyter.iclientpy.iclient.Layer function in jupyter

To help you get started, we’ve selected a few jupyter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SuperMap / iclient-python / jupyter / iclientpy / iclient.py View on Github external
def __isub__(self, other):
        if isinstance(other, Layer):
            self.add_layer(other)
github SuperMap / iclient-python / jupyter / iclientpy / iclient.py View on Github external
# @register
class Map(DOMWidget):
    @default('layout')
    def _default_layout(self):
        return Layout(height='400px', align_self='stretch')

    _view_name = Unicode('SuperMapMapView').tag(sync=True)
    _model_name = Unicode('SuperMapMapModel').tag(sync=True)
    _view_module = Unicode('iclientpy').tag(sync=True)
    _model_module = Unicode('iclientpy').tag(sync=True)
    _view_module_version = Unicode(EXTENSION_VERSION).tag(sync=True)
    _model_module_version = Unicode(EXTENSION_VERSION).tag(sync=True)

    # center = List(trait=Float).tag(sync=True)

    layers = Tuple(trait=Instance(Layer)).tag(sync=True, **widget_serialization)
    layer_ids = List()

    @validate('layers')
    def _validate_layers(self, proposal):
        self.layer_ids = [l.model_id for l in proposal['value']]
        # if len(set(self.layer_ids) != len(self.layer_ids)):
        #     raise Exception('duplicate layer detected')
        return proposal['value']

    def add_layer(self, layer):
        """
        :type layer:Layer
        :param layer:
        :return:
        """
        if layer.model_id in self.layer_ids:
github SuperMap / iclient-python / jupyter / iclientpy / iclient.py View on Github external
_view_name = Unicode("SuperMapMarkerView").tag(sync=True)
    _model_name = Unicode("SuperMapMarkerModel").tag(sync=True)
    _view_module = Unicode("iclientpy").tag(sync=True)
    _model_module = Unicode("iclientpy").tag(sync=True)
    _view_module_version = Unicode(EXTENSION_VERSION).tag(sync=True)
    _model_module_version = Unicode(EXTENSION_VERSION).tag(sync=True)

    lonlat = Tuple(trait=Float).tag(sync=True)
    icon = Instance(klass=Icon).tag(sync=True, **widget_serialization)

    @default("icon")
    def _default_keys(self):
        return Icon()


class Markers(Layer):
    _view_name = Unicode("SuperMapMarkersView").tag(sync=True)
    _model_name = Unicode("SuperMapMarkersModel").tag(sync=True)

    is_base_layer = Bool(False).tag(sync=True)
    opacity = Float(default_value=1).tag(sync=True)

    @validate("opacity")
    def _validate_opacity(self, proposal):
        return proposal['value']

    markers = Tuple(trait=Instance(Marker)).tag(sync=True, **widget_serialization)
    marker_ids = List()

    @validate('markers')
    def _validate_markers(self, proposal):
        self.marker_ids = [m.model_id for m in proposal['value']]