Skip to content

Commit

Permalink
disable lto
Browse files Browse the repository at this point in the history
  • Loading branch information
ciscorn committed Jan 6, 2024
1 parent 292d00e commit 6bf4059
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 16 deletions.
3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,3 @@ members = [
"nusamai",
]
resolver = "2"

[profile.release]
lto = true
16 changes: 13 additions & 3 deletions nusamai-citygml/src/geometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,19 @@ pub struct GeometryRefEntry {

pub type GeometryRef = Vec<GeometryRefEntry>;

#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[derive(Debug, Default)]
pub enum CRS {
#[default]
WGS84,
JGD2011,
}

/// Geometries in a toplevel city object and its children.
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[derive(Debug, Default)]
pub struct Geometries {
pub struct GeometryStore {
pub crs: CRS,
pub vertices: Vec<[f64; 3]>,
pub multipolygon: MultiPolygon<'static, 1, u32>,
pub multilinestring: MultiLineString<'static, 1, u32>,
Expand Down Expand Up @@ -75,7 +84,7 @@ impl GeometryCollector {
}));
}

pub fn into_geometries(self) -> Geometries {
pub fn into_geometries(self) -> GeometryStore {
let mut vertices = Vec::with_capacity(self.vertices.len());
for vbits in &self.vertices {
vertices.push([
Expand All @@ -84,7 +93,8 @@ impl GeometryCollector {
f64::from_bits(vbits[2]),
]);
}
Geometries {
GeometryStore {
crs: CRS::JGD2011,
vertices,
multipolygon: self.multipolygon,
multilinestring: self.multilinestring,
Expand Down
2 changes: 1 addition & 1 deletion nusamai-citygml/src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub type Map = indexmap::IndexMap<String, Value>;
#[derive(Debug, Deserialize, Serialize)]
pub struct CityObject {
pub root: Value,
pub geometries: geometry::Geometries,
pub geometries: geometry::GeometryStore,
}

#[derive(Debug, Serialize, Deserialize, PartialEq)]
Expand Down
5 changes: 3 additions & 2 deletions nusamai-citygml/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ use url::Url;

use crate::codelist::{self, CodeResolver};
use crate::geometry::{
Geometries, GeometryCollector, GeometryParseType, GeometryRef, GeometryRefEntry, GeometryType,
GeometryCollector, GeometryParseType, GeometryRef, GeometryRefEntry, GeometryStore,
GeometryType,
};
use crate::namespace::{wellknown_prefix_from_nsres, GML31_NS};

Expand Down Expand Up @@ -294,7 +295,7 @@ impl<R: BufRead> SubTreeReader<'_, '_, R> {
&self.state.context
}

pub fn collect_geometries(&mut self) -> Geometries {
pub fn collect_geometries(&mut self) -> GeometryStore {
let collector = std::mem::take(&mut self.state.geometry_collector);
collector.into_geometries()
}
Expand Down
2 changes: 1 addition & 1 deletion nusamai-plateau/examples/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use nusamai_citygml::{object::Value, CityGMLElement, CityGMLReader, ParseError,
#[derive(Debug, Deserialize, Serialize)]
struct TopLevelCityObject {
root: Value,
geometries: nusamai_citygml::Geometries,
geometries: nusamai_citygml::GeometryStore,
}

fn example_toplevel_dispatcher<R: BufRead>(
Expand Down
6 changes: 4 additions & 2 deletions nusamai-plateau/tests/test_cityfurniture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ use std::path::Path;

use url::Url;

use nusamai_citygml::{CityGMLElement, CityGMLReader, Code, Geometries, ParseError, SubTreeReader};
use nusamai_citygml::{
CityGMLElement, CityGMLReader, Code, GeometryStore, ParseError, SubTreeReader,
};
use nusamai_plateau::models::cityfurniture::CityFurniture;
use nusamai_plateau::models::TopLevelCityObject;

#[derive(Default, Debug)]
struct ParsedData {
cityfurnitures: Vec<CityFurniture>,
geometries: Vec<Geometries>,
geometries: Vec<GeometryStore>,
}

fn toplevel_dispatcher<R: BufRead>(st: &mut SubTreeReader<R>) -> Result<ParsedData, ParseError> {
Expand Down
4 changes: 2 additions & 2 deletions nusamai-plateau/tests/test_relief.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ use std::path::Path;

use url::Url;

use nusamai_citygml::{CityGMLElement, CityGMLReader, Geometries, ParseError, SubTreeReader};
use nusamai_citygml::{CityGMLElement, CityGMLReader, GeometryStore, ParseError, SubTreeReader};
use nusamai_plateau::models::{relief, ReliefFeature, TopLevelCityObject};

#[derive(Default, Debug)]
struct ParsedData {
relief: Vec<ReliefFeature>,
geometries: Vec<Geometries>,
geometries: Vec<GeometryStore>,
}

fn toplevel_dispatcher<R: BufRead>(st: &mut SubTreeReader<R>) -> Result<ParsedData, ParseError> {
Expand Down
4 changes: 2 additions & 2 deletions nusamai-plateau/tests/test_transportations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ use std::path::Path;
use url::Url;

use nusamai_citygml::{
CityGMLElement, CityGMLReader, Code, Geometries, Measure, ParseError, SubTreeReader,
CityGMLElement, CityGMLReader, Code, GeometryStore, Measure, ParseError, SubTreeReader,
};
use nusamai_plateau::models::Road;
use nusamai_plateau::models::TopLevelCityObject;

#[derive(Default, Debug)]
struct ParsedData {
roads: Vec<Road>,
geometries: Vec<Geometries>,
geometries: Vec<GeometryStore>,
}

fn toplevel_dispatcher<R: BufRead>(st: &mut SubTreeReader<R>) -> Result<ParsedData, ParseError> {
Expand Down

0 comments on commit 6bf4059

Please sign in to comment.