# Ako nakresliť mnohouholník v OpenLayers 3?

Ako svoju požiadavku na projekt chcem nakresliť mnohouholník, ktorý bude vyzerať takto(>. V takom prípade nakreslite strany polygónu príliš husté na to, aby ste vytvorili oblúk. Toto bolo úspešne nakreslené pomocouLineStringale ako to nakresliť pomocou mnohouholníka. Potrebujem mnohouholník, pretože musím medzi tým vyplniť farbu.

kód v OpenLayers 2

var linearRing = nový OpenLayers.Geometry.LinearRing (vrcholy); vrátiť nový OpenLayers.Geometry.Polygon ([linearRing]);

Tu sú vrcholy pole bodov úspešne nakreslených ako obrázok v OpenLayers 3

var layerLines = new ol.layer.Vector ({zdroj: new ol.source.Vector ({features: [new ol.Feature ({geometry: new ol.geom.LineString (markers, 'XY'),}))} ) // štýl: ikonaStyle}); map.addLayer (layerLines);

Pracuje, ale nemôže vyplniť medzipriestor.

Ak vymenímegeometria: new ol.geom.LineString (markery, 'XY'),riadok týmto

geometria: new ol.geom.Polygon (markery, 'XY'),

potom nemôže nakresliť mnohouholník

Tento kód funguje správne. kde vrcholy sú pole súradníc

## Some Notes On Usage

### Usage - Type

The above examples demonstrate the generality/genericity of the Wykobi library routines with regards to numerical type. However this may be somewhat misleading as not all types can provide the necessary precision required to obtain satisfactory results from the routines. Consequently one must approach problems with at least some information relating to bounds and required precision and efficiency. This is a problem that a library can never solve but rather provide the end developer the tools and options by which they can make the necessary decisions to solve their problem.

### Usage - Robustness

Wykobi's routines make assumptions about the validity of types being passed to them. Typically these assumptions are manifest by the lack of assertions and type degeneracy checks within the routines themselves. This is done so as to provide the most optimal implementation of the routine without causing the routine to fail, and to leave the details of type validation to the end user as they see fit.

Theoretically each of the routines could verify object degeneracy (e.g: does the triangle have 3 unique points), then type value validity (e.g: does the value lie within some plausible range) but the unnecessary overhead one must endure would make using the routines quite inefficient. As an example consider what the circumcircle of a triangle that has all 3 of its points being collinear would look like, how would you write the routine to be robust, when would you need to have a robust routine like that?

### Usage - Correctness

Typical usage patterns involve chaining the output of one routine as the input of another so on and so forth. Not knowing the exact nature of the computation will lead to an aggregation of errors that might result in the final outcome being highly erroneous and subsequently unusable. An example of this is as follows, assume you have an arm of length x with one end statically positioned at the origin, requests for rotations of the arm come through, in degree form, +1, -13.5, +290 etc.