示例#1
0
    def __init__(self, iface, template, layer):
        """Constructor for the Composition Report class.

        :param iface: Reference to the QGIS iface object.
        :type iface: QgsAppInterface

        :param template: The QGIS template path.
        :type template: str
        """
        LOGGER.debug('InaSAFE Impact Report class initialised')
        self._iface = iface
        self._template = None
        self.template = template
        self._layer = layer
        self._extent = self._iface.mapCanvas().extent()
        self._page_dpi = 300.0
        self._black_inasafe_logo = black_inasafe_logo_path()
        self._white_inasafe_logo = white_inasafe_logo_path()
        # User can change this path in preferences
        self._organisation_logo = supporters_logo_path()
        self._supporters_logo = supporters_logo_path()
        self._north_arrow = default_north_arrow_path()
        self._disclaimer = disclaimer()

        # For QGIS < 2.4 compatibility
        # QgsMapSettings is added in 2.4
        if qgis_version() < 20400:
            map_settings = self._iface.mapCanvas().mapRenderer()
        else:
            map_settings = self._iface.mapCanvas().mapSettings()

        self._template_composition = TemplateComposition(
            template_path=self.template,
            map_settings=map_settings)
        self._keyword_io = KeywordIO()
示例#2
0
    def __init__(self, iface, template, layer):
        """Constructor for the Composition Report class.

        :param iface: Reference to the QGIS iface object.
        :type iface: QgsAppInterface

        :param template: The QGIS template path.
        :type template: str
        """
        LOGGER.debug('InaSAFE Impact Report class initialised')
        self._iface = iface
        self._template = template
        self._layer = layer
        self._extent = self._iface.mapCanvas().extent()
        self._page_dpi = 300.0
        self._black_inasafe_logo = black_inasafe_logo_path()
        self._white_inasafe_logo = white_inasafe_logo_path()
        # User can change this path in preferences
        self._organisation_logo = supporters_logo_path()
        self._supporters_logo = supporters_logo_path()
        self._north_arrow = default_north_arrow_path()
        self._disclaimer = disclaimer()

        # For QGIS < 2.4 compatibility
        # QgsMapSettings is added in 2.4
        if qgis_version() < 20400:
            map_settings = self._iface.mapCanvas().mapRenderer()
        else:
            map_settings = self._iface.mapCanvas().mapSettings()

        self._template_composition = TemplateComposition(
            template_path=self.template, map_settings=map_settings)
        self._keyword_io = KeywordIO()
示例#3
0
 def __init__(self):
     """Create InaSAFE Report context."""
     self._black_inasafe_logo = black_inasafe_logo_path()
     self._white_inasafe_logo = white_inasafe_logo_path()
     # User can change this path in preferences
     self._organisation_logo = supporters_logo_path()
     self._supporters_logo = supporters_logo_path()
     self._north_arrow = default_north_arrow_path()
     self._disclaimer = disclaimer()
示例#4
0
 def test_black_inasafe_logo_path(self):
     """Verify the call to default InaSAFE logo path works.
     """
     # Check if it exists
     logo_path = QFile(black_inasafe_logo_path())
     self.assertTrue(QFile.exists(logo_path))
示例#5
0
    version_title_header,
    reference_title_header,
    unknown_source_text,
    aggregation_not_used_text,
    crs_text]

"""Image elements"""

white_inasafe_logo_path = {
    'id': 'inasafe-logo-white',
    'path': white_inasafe_logo_path()
}

black_inasafe_logo_path = {
    'id': 'inasafe-logo-black',
    'path': black_inasafe_logo_path()
}

inasafe_north_arrow_path = {
    'id': 'north-arrow-logo',
    'path': setting('north_arrow_path'),
    'setting_key': 'north_arrow_path'
}

inasafe_organisation_logo_path = {
    'id': 'organisation-logo',
    # We default to the supporters logo, but an org can change to their logo
    # in options ...
    'path': setting('organisation_logo_path'),
    'setting_key': 'organisation_logo_path'
}
示例#6
0
 def test_black_inasafe_logo_path(self):
     """Verify the call to default InaSAFE logo path works."""
     # Check if it exists
     logo_path = QFile(black_inasafe_logo_path())
     self.assertTrue(QFile.exists(logo_path))
示例#7
0
    version_title_header,
    reference_title_header,
    unknown_source_text,
    aggregation_not_used_text,
    crs_text]

"""Image elements"""

white_inasafe_logo_path = {
    'id': 'inasafe-logo-white',
    'path': white_inasafe_logo_path()
}

black_inasafe_logo_path = {
    'id': 'inasafe-logo-black',
    'path': black_inasafe_logo_path()
}

inasafe_north_arrow_path = {
    'id': 'north-arrow-logo',
    'path': default_north_arrow_path()
}

inasafe_organisation_logo_path = {
    'id': 'organisation-logo',
    # We default to the supporters logo, but an org can change to their logo
    # in options ...
    'path': supporters_logo_path()
}

image_variable_elements = [