Skip to content

Commit

Permalink
final patch of 3.28-aimed release
Browse files Browse the repository at this point in the history
  • Loading branch information
kauevestena committed Dec 17, 2023
1 parent ec3086d commit 0dff161
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 10 deletions.
59 changes: 59 additions & 0 deletions assets/roads_p3.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
<qgis version="3.28.13-Firenze" styleCategories="Symbology">
<renderer-v2 symbollevels="0" enableorderby="0" type="singleSymbol" forceraster="0" referencescale="-1">
<symbols>
<symbol force_rhr="0" clip_to_extent="1" is_animated="0" type="line" alpha="1" name="0" frame_rate="10">
<data_defined_properties>
<Option type="Map">
<Option type="QString" name="name" value=""/>
<Option name="properties"/>
<Option type="QString" name="type" value="collection"/>
</Option>
</data_defined_properties>
<layer pass="0" locked="0" enabled="1" class="SimpleLine">
<Option type="Map">
<Option type="QString" name="align_dash_pattern" value="0"/>
<Option type="QString" name="capstyle" value="square"/>
<Option type="QString" name="customdash" value="5;2"/>
<Option type="QString" name="customdash_map_unit_scale" value="3x:0,0,0,0,0,0"/>
<Option type="QString" name="customdash_unit" value="MM"/>
<Option type="QString" name="dash_pattern_offset" value="0"/>
<Option type="QString" name="dash_pattern_offset_map_unit_scale" value="3x:0,0,0,0,0,0"/>
<Option type="QString" name="dash_pattern_offset_unit" value="MM"/>
<Option type="QString" name="draw_inside_polygon" value="0"/>
<Option type="QString" name="joinstyle" value="bevel"/>
<Option type="QString" name="line_color" value="157,157,157,255"/>
<Option type="QString" name="line_style" value="solid"/>
<Option type="QString" name="line_width" value="0.4"/>
<Option type="QString" name="line_width_unit" value="MM"/>
<Option type="QString" name="offset" value="0"/>
<Option type="QString" name="offset_map_unit_scale" value="3x:0,0,0,0,0,0"/>
<Option type="QString" name="offset_unit" value="MM"/>
<Option type="QString" name="ring_filter" value="0"/>
<Option type="QString" name="trim_distance_end" value="0"/>
<Option type="QString" name="trim_distance_end_map_unit_scale" value="3x:0,0,0,0,0,0"/>
<Option type="QString" name="trim_distance_end_unit" value="MM"/>
<Option type="QString" name="trim_distance_start" value="0"/>
<Option type="QString" name="trim_distance_start_map_unit_scale" value="3x:0,0,0,0,0,0"/>
<Option type="QString" name="trim_distance_start_unit" value="MM"/>
<Option type="QString" name="tweak_dash_pattern_on_corners" value="0"/>
<Option type="QString" name="use_custom_dash" value="0"/>
<Option type="QString" name="width_map_unit_scale" value="3x:0,0,0,0,0,0"/>
</Option>
<data_defined_properties>
<Option type="Map">
<Option type="QString" name="name" value=""/>
<Option name="properties"/>
<Option type="QString" name="type" value="collection"/>
</Option>
</data_defined_properties>
</layer>
</symbol>
</symbols>
<rotation/>
<sizescale/>
</renderer-v2>
<blendMode>0</blendMode>
<featureBlendMode>0</featureBlendMode>
<layerGeometryType>1</layerGeometryType>
</qgis>
48 changes: 45 additions & 3 deletions generic_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
# from qgis.PyQt.QtCore import QVariant
from qgis import processing
from processing.tools import dataobjects
from qgis.core import QgsCoordinateReferenceSystem, QgsVectorLayer, QgsProject, edit, QgsGeometry, QgsProperty, QgsField, QgsFeature, QgsRasterLayer, QgsSpatialIndex, QgsFeatureRequest, QgsGeometryUtils, QgsVector, QgsCoordinateTransform, QgsMultiPoint, QgsPoint, QgsPointXY, QgsProperty, QgsApplication
from qgis.core import QgsCoordinateReferenceSystem, QgsVectorLayer, QgsProject, edit, QgsGeometry, QgsProperty, QgsField, QgsFeature, QgsRasterLayer, QgsSpatialIndex, QgsFeatureRequest, QgsGeometryUtils, QgsVector, QgsCoordinateTransform, QgsMultiPoint, QgsPoint, QgsPointXY, QgsProperty, QgsApplication #, QgsRendererCategory, QgsSymbol, QgsLineSymbol, QgsCategorizedSymbolRenderer

from processing.gui.AlgorithmExecutor import execute_in_place

import os, json
import os, json #, random
from math import isclose,pi


Expand Down Expand Up @@ -1347,4 +1347,46 @@ def remove_unconnected_lines_v2(inputlayer):
break

if not_intersecting:
inputlayer.deleteFeature(feat_id)
inputlayer.deleteFeature(feat_id)

# def generate_bounded_color(vmin=100,vmax=200):
# """Generate a random color with each channel limited to max_brightness."""
# r = random.randint(vmin,vmax)
# g = random.randint(vmin,vmax)
# b = random.randint(vmin,vmax)

# # returning as hex:
# return f'#{r:02x}{g:02x}{b:02x}'


# def style_line_random_colors(layer, field_name,previous_dict=None):

# # renderer = layer.renderer()
# # symbol = renderer.symbol()

# # if symbol.type() == QgsSymbol.Line:
# categories = {}
# colors = {}

# fields = layer.fields()
# field_index = fields.indexFromName(field_name)
# unique_values = layer.uniqueValues(field_index)

# for value in unique_values:
# if previous_dict:
# if value in previous_dict:
# categories[value] = QgsRendererCategory(str(value), QgsLineSymbol.createSimple({'color': previous_dict[value], 'width': .5}),str(value))

# else:
# color = generate_bounded_color()

# categories[value] = QgsRendererCategory(value, QgsLineSymbol.createSimple({'color': color, 'width': .5}),f'{value}')
# colors[value] = color

# renderer = QgsCategorizedSymbolRenderer(field_name, list(categories.values()))
# layer.setRenderer(renderer)

# layer.triggerRepaint()

# return colors

4 changes: 2 additions & 2 deletions metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

[general]
name=OSM SidewalKreator
qgisMinimumVersion=3.22.2
qgisMinimumVersion=3.28
description=Plugin designated to create the Geometries of Sidewalks (separated from streets) based on OpenStreetMap Streets, given a bounding polygon, outputting to a .geojson to be imported on JOSM. It is mostly intended for accessibility Mapping.
version=1.1
version=1.2
author=Kaue de Moraes Vestena
email=kauemv2@gmail.com

Expand Down
15 changes: 11 additions & 4 deletions osm_sidewalkreator.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ def change_all_labels_bylang(self):
(self.dlg.opt_perp_crossings,'perpen-\ndicularly','perpendi-\ncularmente'),
(self.dlg.label_inward_d,'distance\ninward','distância\nadentro'),
(self.dlg.voronoi_checkbox,'Use Voronoi Polygons Rule','Usar Polígonos de Voronoi'),
(self.dlg.alongside_vor_checkbox,'Alongside with another option','Junto à Outra Opção'),
(self.dlg.alongside_vor_checkbox,'Alongside another option','Junto à Outra Opção'),
(self.dlg.maxlensplit_checkbox,'Max Len.','Larg. Máx.'),
(self.dlg.segsbynum_checkbox,'In x\nsegments','Em x\nsegmentos'),
(self.dlg.onlyfacades_checkbox,'Only Facades',' Faces Q.'),
Expand Down Expand Up @@ -631,7 +631,9 @@ def data_clean(self):
for i in range(self.dlg.dead_end_iters_box.value()):
# without second input, the function will work just as before
remove_lines_from_no_block(self.splitted_lines)


# adding same style again:
# style_line_random_colors(self.clipped_reproj_datalayer,highway_tag,self.streets_styledict)

##### creating points of intersection:
intersection_points = get_intersections(self.splitted_lines,self.splitted_lines,'TEMPORARY_OUTPUT')
Expand Down Expand Up @@ -920,10 +922,12 @@ def sidewalks_splitting(self):
# print(QgsProject.instance().mapLayers())

self.add_layer_canvas(self.whole_sidewalks)
self.whole_sidewalks.loadNamedStyle(self.sidewalk_stylefile_path)
# self.whole_sidewalks.loadNamedStyle(self.sidewalk_stylefile_path)
apply_style(self.whole_sidewalks,sidewalks_stylefilename)

self.add_layer_canvas(self.crossings_layer)
self.crossings_layer.loadNamedStyle(self.crossings_stylefile_path)
# self.crossings_layer.loadNamedStyle(self.crossings_stylefile_path)
apply_style(self.crossings_layer,crossings_stylefilename)


# kerbs:
Expand Down Expand Up @@ -2564,6 +2568,9 @@ def call_get_osm_data(self):
self.set_text_based_on_language(self.dlg.input_status_of_data,'data acquired!','Dados Obtidos!!')
self.dlg.datafetch_progressbar.setValue(100)

# setting style on roads:
# self.streets_styledict = style_line_random_colors(self.clipped_reproj_datalayer,highway_tag)


def set_text_based_on_language(self,qt_object,en_txt,ptbr_txt,extra_control_bool=True):
if extra_control_bool:
Expand Down
2 changes: 1 addition & 1 deletion osm_sidewalkreator_dialog_base.ui
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ dead-end-streets
<bool>false</bool>
</property>
<property name="text">
<string>Alongside with another option</string>
<string>Alongside another option</string>
</property>
</widget>
</item>
Expand Down

0 comments on commit 0dff161

Please sign in to comment.