Пример #1
0
    def create_rule(self, local_min, local_max, global_min, global_range, attr="value"):
        rule = self.style_factory.createRule()
        cql_filters = []
        if not local_min == None:
            cql_filters.append("%s >= %s" % (attr, local_min))
        if not local_max == None:
            cql_filters.append("%s < %s" % (attr, local_max))
        cql = " and ".join(cql_filters)
        gt_filter = CQL.toFilter(cql)
        rule.setFilter(gt_filter)
        if local_min == None:
            brightness = 1.0
        else:
            brightness = 1.0 - (local_min - global_min)/global_range

        color = Color.HSBtoRGB(0.0, 0.0, brightness)

        fill = self.style_factory.createFill(
                self.filter_factory.literal(color),
                self.filter_factory.literal(1)
                )
        symbolizer = self.style_factory.createPolygonSymbolizer(None, fill, None)
        rule.symbolizers().add(symbolizer)
        return rule
Пример #2
0
def _toCQL(filter):
  """Encodes a filter object as a CQL string."""

  return CQL.toCQL(filter)
Пример #3
0
def _fromCQL(cql):
  """Parses a CQL string into a filter object."""

  return CQL.toFilter(cql)
Пример #4
0
def _toCQL(filter):
  """Encodes a filter object as a CQL string."""

  return CQL.toCQL(filter)
Пример #5
0
def _fromCQL(cql):
  """Parses a CQL string into a filter object."""

  return CQL.toFilter(cql)