|
| 1 | +<!-- Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +or more contributor license agreements. See the NOTICE file |
| 3 | +distributed with this work for additional information |
| 4 | +regarding copyright ownership. The ASF licenses this file |
| 5 | +to you under the Apache License, Version 2.0 (the |
| 6 | +"License"); you may not use this file except in compliance |
| 7 | +with the License. You may obtain a copy of the License at |
| 8 | +
|
| 9 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +
|
| 11 | +Unless required by applicable law or agreed to in writing, |
| 12 | +software distributed under the License is distributed on an |
| 13 | +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +KIND, either express or implied. See the License for the |
| 15 | +specific language governing permissions and limitations |
| 16 | +under the License. --> |
| 17 | + |
| 18 | +# Geo-Traits Extended |
| 19 | + |
| 20 | +This crate extends the `geo-traits` crate with additional traits and |
| 21 | +implementations. The goal is to provide a set of traits that are useful for |
| 22 | +implementing algorithms in `geo-generic-alg` crate. Most of the methods are |
| 23 | +inspired by the `geo-types` crate, but are implemented as traits for the |
| 24 | +`geo-traits` types. Some methods returns concrete types defined in `geo-types`, |
| 25 | +these methods are only for computing tiny, intermediate results during |
| 26 | +algorithm execution. By adding methods in `geo-types` to `geo-traits-ext`, |
| 27 | +we can port algorithms in `geo` crate for concrete `geo-types` types to generic |
| 28 | +`geo-traits-ext` types more easily. |
| 29 | + |
| 30 | +`geo-traits-ext` traits also has an associated `Tag` type to workaround the |
| 31 | +single orphan rule in Rust. For instance, we cannot write blanket `AreaTrait` |
| 32 | +implementations for both `LineStringTrait` and `PolygonTrait` because we |
| 33 | +cannot show that there would be no type implementing both `LineStringTrait` and |
| 34 | +`PolygonTrait`. By adding an associated `Tag` type, we can write blanket |
| 35 | +implementations for `AreaTrait<LineStringTag>` and `AreaTrait<PolygonTag>`, since |
| 36 | +`AreaTrait<LineStringTag>` and `AreaTrait<PolygonTag>` are different types. |
| 37 | +Please refer to the source code of `geo-generic-alg` for more details. |
0 commit comments