【译】QGIS培训手册-样式(3)

3.2.8. moderate 跟我做:对符号层次排序(Follow Along: Ordering Symbol Levels)

符号图层是按照一定的顺序进行渲染的,其方式类似于地图图层。这意味着在某些情况下,如果一个符号拥有很多符号图层可能会导致一些意外结果。(When symbol layers are rendered, they are also rendered in a sequence, similar to the way the different map layers are rendered. This means that in some cases, having many symbol layers in one symbol can cause unexpected results.)

  • 用之前介绍的方法为 roads  图层添加一个额外的符号图层。(Give the roads layer an extra symbol layer (using the method for adding symbol layers demonstrated above).)
  • 将线条宽度设置为0.3,边界样式设置为点虚线,线条颜色色设为白色。(Give the base line a Pen width of 0.3, a white color and select Dashed Line from thePen Style dropdown.)
  • Give the new, uppermost layer a thickness of 1.3 and ensure that it is a Solid Line.

你会看到地图变成了这个样子:(You’ll notice that this happens:)

../../../_images/bad_roads_symbology.png

好吧,这根本就不是我们想要设置的样子。(Well that’s not what we want at all!)

为了防止这种情况发生,你可以对符号图层进行排序从而控制不同的符号图层渲染呈现的顺序。(To prevent this from happening, you can sort the symbol levels and thereby control the order in which the different symbol layers are rendered.)

你可以通过以下方式来改变符号图层的顺序,在符号图层面板中选中 Line  层,并点击右侧下发的高级-> 符号层次。然后就会打开一个下面这样的对话框。(To change the order of the symbol layers, select the Line layer in the Symbol layers panel, then click Advanced -> Symbol levels…in the bottom right-hand corner of the window. This will open a dialog like this:)

../../../_images/symbol_levels_dialog.png

选中启用符号层次。你可以通过输入相关数字来调整他们的渲染顺序。0表示最底下的那层。Select Enable symbol levels. You can then set the layer ordering of each symbol by entering the corresponding level number. 0 is the bottom layer.

在此例中,我们会将顺序像这样翻转一下:(In our case, we want to reverse the ordering, like this:)

../../../_images/correct_symbol_layers.png

这样,白色的虚线将会呈现在黑线上面了。(This will render the dashed, white line above the thick black line.)

  • 点击两次确定,返回到地图。(Click OK twice to return to the map.)

地图变成了这样:(The map will now look like this:)

../../../_images/better_roads_symbology.png

现在,交汇点的道路现在”融合”了,所以一条路不会盖在另一条上。Also note that the meeting points of roads are now “merged”, so that one road is not rendered above another.

【译者注:这种方法改变的是渲染顺序,与选中要调整的符号图层后,使用符号图层面板下面的上下箭头来调整的图层排列顺序不同。改变排列顺序,道路的交汇处不会融合在一起,而使用他这种改变渲染顺序的方式,不仅会改变显示的顺序,道路端点交汇处还会融合到一起。或者可以这么理解:如果你不开启符号层次的这个功能,原来的矢量要素是依据其符号图层的设置,将第一根线渲染完毕后,再渲染第二根线,所以端点交汇处就会有遮盖而不是完美融合。而开启后呢,他是先把所有线的第一个符号图层样式渲染完,然后再渲染所有线的第二个图层样式……具体看下图:

QQ截图20150922172119

左边未开启,右边开启】

当你完成后,记得保存这个符号,以防止以后你还会要用到它。可以通过点击位于符号图层面板下面的保存符号按钮来保存当前符号。通常,你应该存储为QGIS Layer Style File 格式的样式文件。When you’re done, remember to save the symbol itself so as not to lose your work if you change the symbol again in the future. You can save your current symbol style by clicking the Save Style … button under the Style tab of the Layer Properties dialog. Generally, you should save as QGIS Layer Style File.

将样式保存在exercise_data/styles目录下面。你可以通过点击加载符号来加载一个之前存好的符号。在改变一个符号之前,要记住任何没有保存的符号都会丢失。(Save your style under exercise_data/styles. You can load a previously saved style at any time by clicking the Load Style …button. Before you change a style, keep in mind that any unsaved style you are replacing will be lost.)

 

3.2.10. hard  动手试(TRY YOURSELF)

符号图层也适用于分类的图层(比如有好几种样式符号的图层),但我们还没教到样式分类,所以你将使用一些基本的预分类数据。Symbol levels also work for classified layers (i.e., layers having multiple symbols). Since we haven’t covered classification yet, you will work with some rudimentary pre-classified data.

  • 创建一副新的地图,并仅添加 roads  数据集。(Create a new map and add only the roads dataset.)
  • 对其应用 exercise_data/styles目录下的 advanced_levels_demo.qml  样式。(Apply the style advanced_levels_demo.qml provided in exercise_data/styles.)
  • 缩放到Swellendam 地区。(Zoom in to the Swellendam area.)
  • 使用符号图层,保证图层的外边线看起来是下面这样的。(Using symbol layers, ensure that the outlines of layers flow into one another as per the image below:)

../../../_images/correct_advanced_levels.png

发表评论来验证你是否做对了

—————————————————–

  • 将符号图层按如下进行设置:(Adjust your symbol levels to these values:)
  • 试验用不同的值来得到不同的结果。(Experiment with different values to get different results.)
  • 在进行下一个练习之前,请打开你之前的那个地图。(Open your original map again before continuing with the next exercise.)

../../../_images/answer_road_symbol_layers.png

—————————————————–

3.2.11. moderate  跟我做:符号图层的类型(FOLLOW ALONG: SYMBOL LAYER TYPES)

除了设置填充颜色和使用预定义的样式,你也完全可以使用不同的符号图层类型。我们一直在使用到现在的唯一类型就是“简单填充”类型。更先进的符号图层类型允许你更进一步的自定义符号。(In addition to setting fill colors and using predefined patterns, you can use different symbol layer types entirely. The only type we’ve been using up to now was the Simple Fill type. The more advanced symbol layer types allow you to customize your symbols even further.)

每种类型的矢量(点、 线、 多边形) 都有其自己的符号图层类型集。首先我们先看看可用的点类型。Each type of vector (point, line and polygon) has its own set of symbol layer types. First we will look at the types available for points.

3.2.11.1. 点图层样式类型(POINT SYMBOL LAYER TYPES)

  • 打开basic_map  项目。(Open your basic_map project.)
  • 改变 places  图层的符号属性:(Change the symbol properties for the places layer:)

../../../_images/places_layer_properties.png

  • 你可以通过选择符号图层面板中的 Simple marker 图层来设置多种符号图层类型,然后点击(右侧的)符号图层类型下拉列表框:You can access the various symbol layer types by selecting the Simple marker layer in theSymbol layers panel, then click the Symbol layer type dropdown:

../../../_images/marker_type_dropdown.png

  • 尝试一下各种可选的选项,然后选择一个你认为比较合适的符号。Investigate the various options available to you, and choose a symbol with styling you think is appropriate.
  • 如果不知道怎么弄好,就设置成一个白边白绿色填充的圆形的点图案填充类型吧,并将其大小设置为3,00,边界宽度设置为0.5。(If in doubt, use a round Simple marker with a white border and pale green fill, with a sizeof 3,00 and an Outline width of0.5.)

3.2.11.2.线符号图层类型(LINE SYMBOL LAYER TYPES)

按以下来查看可用于行数据的各种选项:(To see the various options available for line data:)

  • 将 roads 图层的符号图层中最上面的那一层的类型改为“标记线”:(Change the symbol layer type for the roads layer’s topmost symbol layer to Marker line:)

../../../_images/change_to_marker_line.png

  • 在符号图层面板中选择刚刚出现的“简单标记”图层。将符号属性按下图进行设置:(Select the Simple marker layer in the Symbol layers panel. Change the symbol properties to match this dialog:)

../../../_images/simple_marker_line_properties.png

  • 将间隔设置为 1,00:(要选中“标记线”层)(Change the interval to 1,00:)

../../../_images/marker_line_interval.png

  • 在应用样式之前要确保符号层次是正确的 (通过我们先前使用的高级>符号层次对话框)。(Ensure that the symbol levels are correct (via the Advanced -> Symbol levels dialog we used earlier) before applying the style.)

应用了这个样式后,看看它的在地图上的结果。正如你所看到的这些符号能随着路改变方向,但不会随之弯曲。有些人喜欢这样,有些人不喜欢。如果你愿意,你可以将其调整回原来的样式。【译者注:我没有太明白这一段作者是啥意思,翻译的也可能不对,欢迎批评指正】(Once you have applied the style, take a look at its results on the map. As you can see, these symbols change direction along with the road but don’t always bend along with it. This is useful for some purposes, but not for others. If you prefer, you can change the symbol layer in question back to the way it was before.)

3.2.11.3. 多边形符号图层类型(POLYGON SYMBOL LAYER TYPES)

按此来查看用于多边形数据的各类选项:(To see the various options available for polygon data:)

  • 将 water  图层的符号图层类型进行调整,这个跟之前调整其他图层的操作类似。(Change the symbol layer type for the water layer, as before for the other layers.)
  • 研究一下列表中的不同选项能做些什么。(Investigate what the different options on the list can do.)
  • 按你的喜好对他们进行设置。(Choose one of them that you find suitable.)
  • 如果无从下手,可以按照以下的步骤使用点图案填充:(If in doubt, use the Point pattern fill with the following options:)

../../../_images/pattern_fill_size.png../../../_images/pattern_fill_distances.png

  • 添加一个新的符号图层,并设置为简单填充的类型。(Add a new symbol layer with a normal Simple fill.)
  • 将其填充色设为浅蓝色,边框设为深蓝色。(Make it the same light blue with a darker blue border.)
  • 通过下移箭头将此层调整到点填充图层的下面:(Move it underneath the point pattern symbol layer with the Move down button:)

../../../_images/simple_fill_move_down.png最后,你会得到一个有符号纹理的water层,而且你可以自由的设置和调整组成本符号纹理的点的大小、形状和间距。(As a result, you have a textured symbol for the water layer, with the added benefit that you can change the size, shape and distance of the individual dots that make up the texture.)

《【译】QGIS培训手册-样式(3)》有一个想法

发表评论

电子邮件地址不会被公开。 必填项已用*标注

填写验证码: *