mirror of https://codeberg.org/topola/topola.git
refactor(geometry): Access*Weight shouldn't take a generic arg; impl automatically
This commit is contained in:
parent
a67f8ea052
commit
17ea07ab7b
|
|
@ -73,8 +73,6 @@ impl TryFrom<PrimitiveWeight> for BendWeight {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AccessBendWeight<PrimitiveWeight> for BendWeight {}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub struct FixedBendWeight {
|
pub struct FixedBendWeight {
|
||||||
pub width: f64,
|
pub width: f64,
|
||||||
|
|
@ -84,7 +82,6 @@ pub struct FixedBendWeight {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_fixed_weight!(FixedBendWeight, FixedBend, FixedBendIndex);
|
impl_fixed_weight!(FixedBendWeight, FixedBend, FixedBendIndex);
|
||||||
impl AccessBendWeight<PrimitiveWeight> for FixedBendWeight {}
|
|
||||||
|
|
||||||
impl GetOffset for FixedBendWeight {
|
impl GetOffset for FixedBendWeight {
|
||||||
fn offset(&self) -> f64 {
|
fn offset(&self) -> f64 {
|
||||||
|
|
@ -131,4 +128,3 @@ impl GetWidth for LooseBendWeight {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_loose_weight!(LooseBendWeight, LooseBend, LooseBendIndex);
|
impl_loose_weight!(LooseBendWeight, LooseBend, LooseBendIndex);
|
||||||
impl AccessBendWeight<PrimitiveWeight> for LooseBendWeight {}
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ use crate::{
|
||||||
rules::AccessRules,
|
rules::AccessRules,
|
||||||
Drawing,
|
Drawing,
|
||||||
},
|
},
|
||||||
geometry::{AccessDotWeight, GetSetPos, GetWidth},
|
geometry::{GetSetPos, GetWidth},
|
||||||
graph::{GenericIndex, GetPetgraphIndex},
|
graph::{GenericIndex, GetPetgraphIndex},
|
||||||
math::Circle,
|
math::Circle,
|
||||||
};
|
};
|
||||||
|
|
@ -75,8 +75,6 @@ impl TryFrom<PrimitiveWeight> for DotWeight {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AccessDotWeight<PrimitiveWeight> for DotWeight {}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub struct FixedDotWeight {
|
pub struct FixedDotWeight {
|
||||||
pub circle: Circle,
|
pub circle: Circle,
|
||||||
|
|
@ -85,7 +83,6 @@ pub struct FixedDotWeight {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_fixed_weight!(FixedDotWeight, FixedDot, FixedDotIndex);
|
impl_fixed_weight!(FixedDotWeight, FixedDot, FixedDotIndex);
|
||||||
impl AccessDotWeight<PrimitiveWeight> for FixedDotWeight {}
|
|
||||||
|
|
||||||
impl GetSetPos for FixedDotWeight {
|
impl GetSetPos for FixedDotWeight {
|
||||||
fn pos(&self) -> Point {
|
fn pos(&self) -> Point {
|
||||||
|
|
@ -111,7 +108,6 @@ pub struct LooseDotWeight {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_loose_weight!(LooseDotWeight, LooseDot, LooseDotIndex);
|
impl_loose_weight!(LooseDotWeight, LooseDot, LooseDotIndex);
|
||||||
impl AccessDotWeight<PrimitiveWeight> for LooseDotWeight {}
|
|
||||||
|
|
||||||
impl GetSetPos for LooseDotWeight {
|
impl GetSetPos for LooseDotWeight {
|
||||||
fn pos(&self) -> Point {
|
fn pos(&self) -> Point {
|
||||||
|
|
|
||||||
|
|
@ -211,7 +211,7 @@ impl<CW: Copy, R: AccessRules> Drawing<CW, R> {
|
||||||
|
|
||||||
#[debug_ensures(ret.is_ok() -> self.recording_geometry_with_rtree.graph().node_count() == old(self.recording_geometry_with_rtree.graph().node_count() + 1))]
|
#[debug_ensures(ret.is_ok() -> self.recording_geometry_with_rtree.graph().node_count() == old(self.recording_geometry_with_rtree.graph().node_count() + 1))]
|
||||||
#[debug_ensures(ret.is_err() -> self.recording_geometry_with_rtree.graph().node_count() == old(self.recording_geometry_with_rtree.graph().node_count()))]
|
#[debug_ensures(ret.is_err() -> self.recording_geometry_with_rtree.graph().node_count() == old(self.recording_geometry_with_rtree.graph().node_count()))]
|
||||||
fn add_dot_with_infringables<W: AccessDotWeight<PrimitiveWeight> + GetLayer>(
|
fn add_dot_with_infringables<W: AccessDotWeight + Into<PrimitiveWeight> + GetLayer>(
|
||||||
&mut self,
|
&mut self,
|
||||||
recorder: &mut DrawingEdit<CW>,
|
recorder: &mut DrawingEdit<CW>,
|
||||||
weight: W,
|
weight: W,
|
||||||
|
|
@ -286,7 +286,7 @@ impl<CW: Copy, R: AccessRules> Drawing<CW, R> {
|
||||||
#[debug_ensures(ret.is_ok() -> self.recording_geometry_with_rtree.graph().edge_count() >= old(self.recording_geometry_with_rtree.graph().edge_count() + 2))]
|
#[debug_ensures(ret.is_ok() -> self.recording_geometry_with_rtree.graph().edge_count() >= old(self.recording_geometry_with_rtree.graph().edge_count() + 2))]
|
||||||
#[debug_ensures(ret.is_err() -> self.recording_geometry_with_rtree.graph().node_count() == old(self.recording_geometry_with_rtree.graph().node_count()))]
|
#[debug_ensures(ret.is_err() -> self.recording_geometry_with_rtree.graph().node_count() == old(self.recording_geometry_with_rtree.graph().node_count()))]
|
||||||
#[debug_ensures(ret.is_err() -> self.recording_geometry_with_rtree.graph().edge_count() == old(self.recording_geometry_with_rtree.graph().edge_count()))]
|
#[debug_ensures(ret.is_err() -> self.recording_geometry_with_rtree.graph().edge_count() == old(self.recording_geometry_with_rtree.graph().edge_count()))]
|
||||||
fn add_seg_with_infringables<W: AccessSegWeight<PrimitiveWeight> + GetLayer>(
|
fn add_seg_with_infringables<W: AccessSegWeight + Into<PrimitiveWeight> + GetLayer>(
|
||||||
&mut self,
|
&mut self,
|
||||||
recorder: &mut DrawingEdit<CW>,
|
recorder: &mut DrawingEdit<CW>,
|
||||||
from: DotIndex,
|
from: DotIndex,
|
||||||
|
|
@ -373,7 +373,7 @@ impl<CW: Copy, R: AccessRules> Drawing<CW, R> {
|
||||||
#[debug_ensures(ret.is_err() -> self.recording_geometry_with_rtree.graph().node_count() == old(self.recording_geometry_with_rtree.graph().node_count()))]
|
#[debug_ensures(ret.is_err() -> self.recording_geometry_with_rtree.graph().node_count() == old(self.recording_geometry_with_rtree.graph().node_count()))]
|
||||||
#[debug_ensures(ret.is_ok() -> self.recording_geometry_with_rtree.graph().edge_count() == old(self.recording_geometry_with_rtree.graph().edge_count() + 3))]
|
#[debug_ensures(ret.is_ok() -> self.recording_geometry_with_rtree.graph().edge_count() == old(self.recording_geometry_with_rtree.graph().edge_count() + 3))]
|
||||||
#[debug_ensures(ret.is_err() -> self.recording_geometry_with_rtree.graph().edge_count() == old(self.recording_geometry_with_rtree.graph().edge_count()))]
|
#[debug_ensures(ret.is_err() -> self.recording_geometry_with_rtree.graph().edge_count() == old(self.recording_geometry_with_rtree.graph().edge_count()))]
|
||||||
fn add_core_bend_with_infringables<W: AccessBendWeight<PrimitiveWeight> + GetLayer>(
|
fn add_core_bend_with_infringables<W: AccessBendWeight + Into<PrimitiveWeight> + GetLayer>(
|
||||||
&mut self,
|
&mut self,
|
||||||
recorder: &mut DrawingEdit<CW>,
|
recorder: &mut DrawingEdit<CW>,
|
||||||
from: DotIndex,
|
from: DotIndex,
|
||||||
|
|
@ -848,7 +848,7 @@ impl<CW: Copy, R: AccessRules> Drawing<CW, R> {
|
||||||
impl<CW: Copy, R: AccessRules> Drawing<CW, R> {
|
impl<CW: Copy, R: AccessRules> Drawing<CW, R> {
|
||||||
#[debug_ensures(self.recording_geometry_with_rtree.graph().node_count() == old(self.recording_geometry_with_rtree.graph().node_count() + 1))]
|
#[debug_ensures(self.recording_geometry_with_rtree.graph().node_count() == old(self.recording_geometry_with_rtree.graph().node_count() + 1))]
|
||||||
#[debug_ensures(self.recording_geometry_with_rtree.graph().edge_count() == old(self.recording_geometry_with_rtree.graph().edge_count()))]
|
#[debug_ensures(self.recording_geometry_with_rtree.graph().edge_count() == old(self.recording_geometry_with_rtree.graph().edge_count()))]
|
||||||
fn add_dot_infringably<W: AccessDotWeight<PrimitiveWeight> + GetLayer>(
|
fn add_dot_infringably<W: AccessDotWeight + Into<PrimitiveWeight> + GetLayer>(
|
||||||
&mut self,
|
&mut self,
|
||||||
recorder: &mut DrawingEdit<CW>,
|
recorder: &mut DrawingEdit<CW>,
|
||||||
weight: W,
|
weight: W,
|
||||||
|
|
@ -861,7 +861,7 @@ impl<CW: Copy, R: AccessRules> Drawing<CW, R> {
|
||||||
|
|
||||||
#[debug_ensures(self.recording_geometry_with_rtree.graph().node_count() == old(self.recording_geometry_with_rtree.graph().node_count() + 1))]
|
#[debug_ensures(self.recording_geometry_with_rtree.graph().node_count() == old(self.recording_geometry_with_rtree.graph().node_count() + 1))]
|
||||||
#[debug_ensures(self.recording_geometry_with_rtree.graph().edge_count() == old(self.recording_geometry_with_rtree.graph().edge_count() + 2))]
|
#[debug_ensures(self.recording_geometry_with_rtree.graph().edge_count() == old(self.recording_geometry_with_rtree.graph().edge_count() + 2))]
|
||||||
fn add_seg_infringably<W: AccessSegWeight<PrimitiveWeight> + GetLayer>(
|
fn add_seg_infringably<W: AccessSegWeight + Into<PrimitiveWeight> + GetLayer>(
|
||||||
&mut self,
|
&mut self,
|
||||||
recorder: &mut DrawingEdit<CW>,
|
recorder: &mut DrawingEdit<CW>,
|
||||||
from: DotIndex,
|
from: DotIndex,
|
||||||
|
|
|
||||||
|
|
@ -79,8 +79,6 @@ impl TryFrom<PrimitiveWeight> for SegWeight {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AccessSegWeight<PrimitiveWeight> for SegWeight {}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub struct FixedSegWeight {
|
pub struct FixedSegWeight {
|
||||||
pub width: f64,
|
pub width: f64,
|
||||||
|
|
@ -89,7 +87,6 @@ pub struct FixedSegWeight {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_fixed_weight!(FixedSegWeight, FixedSeg, FixedSegIndex);
|
impl_fixed_weight!(FixedSegWeight, FixedSeg, FixedSegIndex);
|
||||||
impl AccessSegWeight<PrimitiveWeight> for FixedSegWeight {}
|
|
||||||
|
|
||||||
impl GetWidth for FixedSegWeight {
|
impl GetWidth for FixedSegWeight {
|
||||||
fn width(&self) -> f64 {
|
fn width(&self) -> f64 {
|
||||||
|
|
@ -105,7 +102,6 @@ pub struct LoneLooseSegWeight {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_loose_weight!(LoneLooseSegWeight, LoneLooseSeg, LoneLooseSegIndex);
|
impl_loose_weight!(LoneLooseSegWeight, LoneLooseSeg, LoneLooseSegIndex);
|
||||||
impl AccessSegWeight<PrimitiveWeight> for LoneLooseSegWeight {}
|
|
||||||
|
|
||||||
impl GetWidth for LoneLooseSegWeight {
|
impl GetWidth for LoneLooseSegWeight {
|
||||||
fn width(&self) -> f64 {
|
fn width(&self) -> f64 {
|
||||||
|
|
@ -121,7 +117,6 @@ pub struct SeqLooseSegWeight {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_loose_weight!(SeqLooseSegWeight, SeqLooseSeg, SeqLooseSegIndex);
|
impl_loose_weight!(SeqLooseSegWeight, SeqLooseSeg, SeqLooseSegIndex);
|
||||||
impl AccessSegWeight<PrimitiveWeight> for SeqLooseSegWeight {}
|
|
||||||
|
|
||||||
impl GetWidth for SeqLooseSegWeight {
|
impl GetWidth for SeqLooseSegWeight {
|
||||||
fn width(&self) -> f64 {
|
fn width(&self) -> f64 {
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,9 @@ use super::{AccessBendWeight, AccessDotWeight, AccessSegWeight, GetWidth};
|
||||||
|
|
||||||
pub trait ApplyGeometryEdit<
|
pub trait ApplyGeometryEdit<
|
||||||
PW: GetWidth + GetLayer + TryInto<DW> + TryInto<SW> + TryInto<BW> + Retag<PI> + Copy,
|
PW: GetWidth + GetLayer + TryInto<DW> + TryInto<SW> + TryInto<BW> + Retag<PI> + Copy,
|
||||||
DW: AccessDotWeight<PW> + GetLayer,
|
DW: AccessDotWeight + Into<PW> + GetLayer,
|
||||||
SW: AccessSegWeight<PW> + GetLayer,
|
SW: AccessSegWeight + Into<PW> + GetLayer,
|
||||||
BW: AccessBendWeight<PW> + GetLayer,
|
BW: AccessBendWeight + Into<PW> + GetLayer,
|
||||||
CW: Copy,
|
CW: Copy,
|
||||||
PI: GetPetgraphIndex + TryInto<DI> + TryInto<SI> + TryInto<BI> + Eq + Ord + Copy,
|
PI: GetPetgraphIndex + TryInto<DI> + TryInto<SI> + TryInto<BI> + Eq + Ord + Copy,
|
||||||
DI: GetPetgraphIndex + Into<PI> + Eq + Ord + Copy,
|
DI: GetPetgraphIndex + Into<PI> + Eq + Ord + Copy,
|
||||||
|
|
@ -38,9 +38,9 @@ pub struct GeometryEdit<PW, DW, SW, BW, CW, PI, DI, SI, BI> {
|
||||||
|
|
||||||
impl<
|
impl<
|
||||||
PW: GetWidth + GetLayer + TryInto<DW> + TryInto<SW> + TryInto<BW> + Retag<PI> + Copy,
|
PW: GetWidth + GetLayer + TryInto<DW> + TryInto<SW> + TryInto<BW> + Retag<PI> + Copy,
|
||||||
DW: AccessDotWeight<PW> + GetLayer,
|
DW: AccessDotWeight + Into<PW> + GetLayer,
|
||||||
SW: AccessSegWeight<PW> + GetLayer,
|
SW: AccessSegWeight + Into<PW> + GetLayer,
|
||||||
BW: AccessBendWeight<PW> + GetLayer,
|
BW: AccessBendWeight + Into<PW> + GetLayer,
|
||||||
CW: Copy,
|
CW: Copy,
|
||||||
PI: GetPetgraphIndex + TryInto<DI> + TryInto<SI> + TryInto<BI> + Eq + Ord + Copy,
|
PI: GetPetgraphIndex + TryInto<DI> + TryInto<SI> + TryInto<BI> + Eq + Ord + Copy,
|
||||||
DI: GetPetgraphIndex + Into<PI> + Eq + Ord + Copy,
|
DI: GetPetgraphIndex + Into<PI> + Eq + Ord + Copy,
|
||||||
|
|
|
||||||
|
|
@ -66,9 +66,14 @@ pub enum GenericNode<P, C> {
|
||||||
Compound(C),
|
Compound(C),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait AccessDotWeight<PW>: GetSetPos + GetWidth + Into<PW> + Copy {}
|
pub trait AccessDotWeight: GetSetPos + GetWidth + Copy {}
|
||||||
pub trait AccessSegWeight<PW>: GetWidth + Into<PW> + Copy {}
|
impl<T: GetSetPos + GetWidth + Copy> AccessDotWeight for T {}
|
||||||
pub trait AccessBendWeight<PW>: SetOffset + GetWidth + Into<PW> + Copy {}
|
|
||||||
|
pub trait AccessSegWeight: GetWidth + Copy {}
|
||||||
|
impl<T: GetWidth + Copy> AccessSegWeight for T {}
|
||||||
|
|
||||||
|
pub trait AccessBendWeight: SetOffset + GetWidth + Copy {}
|
||||||
|
impl<T: SetOffset + GetWidth + Copy> AccessBendWeight for T {}
|
||||||
|
|
||||||
#[derive(Debug, Getters)]
|
#[derive(Debug, Getters)]
|
||||||
pub struct Geometry<PW, DW, SW, BW, CW, PI, DI, SI, BI> {
|
pub struct Geometry<PW, DW, SW, BW, CW, PI, DI, SI, BI> {
|
||||||
|
|
@ -86,9 +91,9 @@ pub struct Geometry<PW, DW, SW, BW, CW, PI, DI, SI, BI> {
|
||||||
|
|
||||||
impl<
|
impl<
|
||||||
PW: GetWidth + TryInto<DW> + TryInto<SW> + TryInto<BW> + Retag<PI> + Copy,
|
PW: GetWidth + TryInto<DW> + TryInto<SW> + TryInto<BW> + Retag<PI> + Copy,
|
||||||
DW: AccessDotWeight<PW>,
|
DW: AccessDotWeight + Into<PW>,
|
||||||
SW: AccessSegWeight<PW>,
|
SW: AccessSegWeight + Into<PW>,
|
||||||
BW: AccessBendWeight<PW>,
|
BW: AccessBendWeight + Into<PW>,
|
||||||
CW: Copy,
|
CW: Copy,
|
||||||
PI: GetPetgraphIndex + TryInto<DI> + TryInto<SI> + TryInto<BI> + Copy,
|
PI: GetPetgraphIndex + TryInto<DI> + TryInto<SI> + TryInto<BI> + Copy,
|
||||||
DI: GetPetgraphIndex + Into<PI> + Copy,
|
DI: GetPetgraphIndex + Into<PI> + Copy,
|
||||||
|
|
@ -111,11 +116,11 @@ impl<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_dot<W: AccessDotWeight<PW>>(&mut self, weight: W) -> GenericIndex<W> {
|
pub fn add_dot<W: AccessDotWeight + Into<PW>>(&mut self, weight: W) -> GenericIndex<W> {
|
||||||
GenericIndex::<W>::new(self.graph.add_node(GenericNode::Primitive(weight.into())))
|
GenericIndex::<W>::new(self.graph.add_node(GenericNode::Primitive(weight.into())))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn add_dot_at_index<W: AccessDotWeight<PW>>(
|
pub(super) fn add_dot_at_index<W: AccessDotWeight + Into<PW>>(
|
||||||
&mut self,
|
&mut self,
|
||||||
dot: GenericIndex<W>,
|
dot: GenericIndex<W>,
|
||||||
weight: W,
|
weight: W,
|
||||||
|
|
@ -124,7 +129,7 @@ impl<
|
||||||
.update_node(dot.petgraph_index(), GenericNode::Primitive(weight.into()));
|
.update_node(dot.petgraph_index(), GenericNode::Primitive(weight.into()));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_seg<W: AccessSegWeight<PW>>(
|
pub fn add_seg<W: AccessSegWeight + Into<PW>>(
|
||||||
&mut self,
|
&mut self,
|
||||||
from: DI,
|
from: DI,
|
||||||
to: DI,
|
to: DI,
|
||||||
|
|
@ -136,7 +141,7 @@ impl<
|
||||||
seg
|
seg
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn add_seg_at_index<W: AccessSegWeight<PW>>(
|
pub(super) fn add_seg_at_index<W: AccessSegWeight + Into<PW>>(
|
||||||
&mut self,
|
&mut self,
|
||||||
seg: GenericIndex<W>,
|
seg: GenericIndex<W>,
|
||||||
from: DI,
|
from: DI,
|
||||||
|
|
@ -148,7 +153,12 @@ impl<
|
||||||
self.init_seg_joints(seg, from, to);
|
self.init_seg_joints(seg, from, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn init_seg_joints<W: AccessSegWeight<PW>>(&mut self, seg: GenericIndex<W>, from: DI, to: DI) {
|
fn init_seg_joints<W: AccessSegWeight + Into<PW>>(
|
||||||
|
&mut self,
|
||||||
|
seg: GenericIndex<W>,
|
||||||
|
from: DI,
|
||||||
|
to: DI,
|
||||||
|
) {
|
||||||
self.graph.update_edge(
|
self.graph.update_edge(
|
||||||
from.petgraph_index(),
|
from.petgraph_index(),
|
||||||
seg.petgraph_index(),
|
seg.petgraph_index(),
|
||||||
|
|
@ -161,7 +171,7 @@ impl<
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_bend<W: AccessBendWeight<PW>>(
|
pub fn add_bend<W: AccessBendWeight + Into<PW>>(
|
||||||
&mut self,
|
&mut self,
|
||||||
from: DI,
|
from: DI,
|
||||||
to: DI,
|
to: DI,
|
||||||
|
|
@ -174,7 +184,7 @@ impl<
|
||||||
bend
|
bend
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn add_bend_at_index<W: AccessBendWeight<PW>>(
|
pub(super) fn add_bend_at_index<W: AccessBendWeight + Into<PW>>(
|
||||||
&mut self,
|
&mut self,
|
||||||
bend: GenericIndex<W>,
|
bend: GenericIndex<W>,
|
||||||
from: DI,
|
from: DI,
|
||||||
|
|
@ -192,7 +202,7 @@ impl<
|
||||||
.update_node(compound.petgraph_index(), GenericNode::Compound(weight));
|
.update_node(compound.petgraph_index(), GenericNode::Compound(weight));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn init_bend_joints_and_core<W: AccessBendWeight<PW>>(
|
fn init_bend_joints_and_core<W: AccessBendWeight + Into<PW>>(
|
||||||
&mut self,
|
&mut self,
|
||||||
bend: GenericIndex<W>,
|
bend: GenericIndex<W>,
|
||||||
from: DI,
|
from: DI,
|
||||||
|
|
@ -556,9 +566,9 @@ impl<
|
||||||
|
|
||||||
impl<
|
impl<
|
||||||
PW: GetWidth + TryInto<DW> + TryInto<SW> + TryInto<BW> + Retag<PI> + Copy,
|
PW: GetWidth + TryInto<DW> + TryInto<SW> + TryInto<BW> + Retag<PI> + Copy,
|
||||||
DW: AccessDotWeight<PW>,
|
DW: AccessDotWeight + Into<PW>,
|
||||||
SW: AccessSegWeight<PW>,
|
SW: AccessSegWeight + Into<PW>,
|
||||||
BW: AccessBendWeight<PW>,
|
BW: AccessBendWeight + Into<PW>,
|
||||||
CW: Copy,
|
CW: Copy,
|
||||||
PI: GetPetgraphIndex + TryInto<DI> + TryInto<SI> + TryInto<BI> + Copy,
|
PI: GetPetgraphIndex + TryInto<DI> + TryInto<SI> + TryInto<BI> + Copy,
|
||||||
DI: GetPetgraphIndex + Into<PI> + Copy,
|
DI: GetPetgraphIndex + Into<PI> + Copy,
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,9 @@ pub struct RecordingGeometryWithRtree<PW, DW, SW, BW, CW, PI, DI, SI, BI> {
|
||||||
|
|
||||||
impl<
|
impl<
|
||||||
PW: GetWidth + GetLayer + TryInto<DW> + TryInto<SW> + TryInto<BW> + Retag<PI> + Copy,
|
PW: GetWidth + GetLayer + TryInto<DW> + TryInto<SW> + TryInto<BW> + Retag<PI> + Copy,
|
||||||
DW: AccessDotWeight<PW> + GetLayer,
|
DW: AccessDotWeight + Into<PW> + GetLayer,
|
||||||
SW: AccessSegWeight<PW> + GetLayer,
|
SW: AccessSegWeight + Into<PW> + GetLayer,
|
||||||
BW: AccessBendWeight<PW> + GetLayer,
|
BW: AccessBendWeight + Into<PW> + GetLayer,
|
||||||
CW: Copy,
|
CW: Copy,
|
||||||
PI: GetPetgraphIndex + TryInto<DI> + TryInto<SI> + TryInto<BI> + Eq + Ord + Copy,
|
PI: GetPetgraphIndex + TryInto<DI> + TryInto<SI> + TryInto<BI> + Eq + Ord + Copy,
|
||||||
DI: GetPetgraphIndex + Into<PI> + Eq + Ord + Copy,
|
DI: GetPetgraphIndex + Into<PI> + Eq + Ord + Copy,
|
||||||
|
|
@ -46,7 +46,7 @@ impl<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_dot<W: AccessDotWeight<PW> + GetLayer>(
|
pub fn add_dot<W: AccessDotWeight + Into<PW> + GetLayer>(
|
||||||
&mut self,
|
&mut self,
|
||||||
recorder: &mut GeometryEdit<PW, DW, SW, BW, CW, PI, DI, SI, BI>,
|
recorder: &mut GeometryEdit<PW, DW, SW, BW, CW, PI, DI, SI, BI>,
|
||||||
weight: W,
|
weight: W,
|
||||||
|
|
@ -67,7 +67,7 @@ impl<
|
||||||
dot
|
dot
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_seg<W: AccessSegWeight<PW> + GetLayer>(
|
pub fn add_seg<W: AccessSegWeight + Into<PW> + GetLayer>(
|
||||||
&mut self,
|
&mut self,
|
||||||
recorder: &mut GeometryEdit<PW, DW, SW, BW, CW, PI, DI, SI, BI>,
|
recorder: &mut GeometryEdit<PW, DW, SW, BW, CW, PI, DI, SI, BI>,
|
||||||
from: DI,
|
from: DI,
|
||||||
|
|
@ -93,7 +93,7 @@ impl<
|
||||||
seg
|
seg
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_bend<W: AccessBendWeight<PW> + GetLayer>(
|
pub fn add_bend<W: AccessBendWeight + Into<PW> + GetLayer>(
|
||||||
&mut self,
|
&mut self,
|
||||||
recorder: &mut GeometryEdit<PW, DW, SW, BW, CW, PI, DI, SI, BI>,
|
recorder: &mut GeometryEdit<PW, DW, SW, BW, CW, PI, DI, SI, BI>,
|
||||||
from: DI,
|
from: DI,
|
||||||
|
|
@ -339,9 +339,9 @@ fn edit_remove_from_map<I: Ord, T>(
|
||||||
|
|
||||||
impl<
|
impl<
|
||||||
PW: GetWidth + GetLayer + TryInto<DW> + TryInto<SW> + TryInto<BW> + Retag<PI> + Copy,
|
PW: GetWidth + GetLayer + TryInto<DW> + TryInto<SW> + TryInto<BW> + Retag<PI> + Copy,
|
||||||
DW: AccessDotWeight<PW> + GetLayer,
|
DW: AccessDotWeight + Into<PW> + GetLayer,
|
||||||
SW: AccessSegWeight<PW> + GetLayer,
|
SW: AccessSegWeight + Into<PW> + GetLayer,
|
||||||
BW: AccessBendWeight<PW> + GetLayer,
|
BW: AccessBendWeight + Into<PW> + GetLayer,
|
||||||
CW: Copy,
|
CW: Copy,
|
||||||
PI: GetPetgraphIndex + TryInto<DI> + TryInto<SI> + TryInto<BI> + Eq + Ord + Copy,
|
PI: GetPetgraphIndex + TryInto<DI> + TryInto<SI> + TryInto<BI> + Eq + Ord + Copy,
|
||||||
DI: GetPetgraphIndex + Into<PI> + Eq + Ord + Copy,
|
DI: GetPetgraphIndex + Into<PI> + Eq + Ord + Copy,
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,9 @@ pub struct GeometryWithRtree<PW, DW, SW, BW, CW, PI, DI, SI, BI> {
|
||||||
#[debug_invariant(self.geometry.graph().node_count() == self.rtree.size())]
|
#[debug_invariant(self.geometry.graph().node_count() == self.rtree.size())]
|
||||||
impl<
|
impl<
|
||||||
PW: GetWidth + GetLayer + TryInto<DW> + TryInto<SW> + TryInto<BW> + Retag<PI> + Copy,
|
PW: GetWidth + GetLayer + TryInto<DW> + TryInto<SW> + TryInto<BW> + Retag<PI> + Copy,
|
||||||
DW: AccessDotWeight<PW> + GetLayer,
|
DW: AccessDotWeight + Into<PW> + GetLayer,
|
||||||
SW: AccessSegWeight<PW> + GetLayer,
|
SW: AccessSegWeight + Into<PW> + GetLayer,
|
||||||
BW: AccessBendWeight<PW> + GetLayer,
|
BW: AccessBendWeight + Into<PW> + GetLayer,
|
||||||
CW: Copy,
|
CW: Copy,
|
||||||
PI: GetPetgraphIndex + TryInto<DI> + TryInto<SI> + TryInto<BI> + PartialEq + Copy,
|
PI: GetPetgraphIndex + TryInto<DI> + TryInto<SI> + TryInto<BI> + PartialEq + Copy,
|
||||||
DI: GetPetgraphIndex + Into<PI> + Copy,
|
DI: GetPetgraphIndex + Into<PI> + Copy,
|
||||||
|
|
@ -68,7 +68,10 @@ impl<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_dot<W: AccessDotWeight<PW> + GetLayer>(&mut self, weight: W) -> GenericIndex<W>
|
pub fn add_dot<W: AccessDotWeight + Into<PW> + GetLayer>(
|
||||||
|
&mut self,
|
||||||
|
weight: W,
|
||||||
|
) -> GenericIndex<W>
|
||||||
where
|
where
|
||||||
GenericIndex<W>: Into<PI>,
|
GenericIndex<W>: Into<PI>,
|
||||||
{
|
{
|
||||||
|
|
@ -77,7 +80,7 @@ impl<
|
||||||
dot
|
dot
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn add_dot_at_index<W: AccessDotWeight<PW> + GetLayer>(
|
pub(super) fn add_dot_at_index<W: AccessDotWeight + Into<PW> + GetLayer>(
|
||||||
&mut self,
|
&mut self,
|
||||||
dot: DI,
|
dot: DI,
|
||||||
weight: W,
|
weight: W,
|
||||||
|
|
@ -87,7 +90,7 @@ impl<
|
||||||
self.init_dot_bbox(dot);
|
self.init_dot_bbox(dot);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_seg<W: AccessSegWeight<PW> + GetLayer>(
|
pub fn add_seg<W: AccessSegWeight + Into<PW> + GetLayer>(
|
||||||
&mut self,
|
&mut self,
|
||||||
from: DI,
|
from: DI,
|
||||||
to: DI,
|
to: DI,
|
||||||
|
|
@ -101,7 +104,7 @@ impl<
|
||||||
seg
|
seg
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn add_seg_at_index<W: AccessSegWeight<PW> + GetLayer>(
|
pub(super) fn add_seg_at_index<W: AccessSegWeight + Into<PW> + GetLayer>(
|
||||||
&mut self,
|
&mut self,
|
||||||
seg: SI,
|
seg: SI,
|
||||||
from: DI,
|
from: DI,
|
||||||
|
|
@ -117,7 +120,7 @@ impl<
|
||||||
self.init_seg_bbox(seg);
|
self.init_seg_bbox(seg);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_bend<W: AccessBendWeight<PW> + GetLayer>(
|
pub fn add_bend<W: AccessBendWeight + Into<PW> + GetLayer>(
|
||||||
&mut self,
|
&mut self,
|
||||||
from: DI,
|
from: DI,
|
||||||
to: DI,
|
to: DI,
|
||||||
|
|
@ -132,7 +135,7 @@ impl<
|
||||||
bend
|
bend
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn add_bend_at_index<W: AccessBendWeight<PW> + GetLayer>(
|
pub(super) fn add_bend_at_index<W: AccessBendWeight + Into<PW> + GetLayer>(
|
||||||
&mut self,
|
&mut self,
|
||||||
bend: BI,
|
bend: BI,
|
||||||
from: DI,
|
from: DI,
|
||||||
|
|
@ -260,9 +263,9 @@ impl<
|
||||||
|
|
||||||
impl<
|
impl<
|
||||||
PW: GetWidth + GetLayer + TryInto<DW> + TryInto<SW> + TryInto<BW> + Retag<PI> + Copy,
|
PW: GetWidth + GetLayer + TryInto<DW> + TryInto<SW> + TryInto<BW> + Retag<PI> + Copy,
|
||||||
DW: AccessDotWeight<PW> + GetLayer,
|
DW: AccessDotWeight + Into<PW> + GetLayer,
|
||||||
SW: AccessSegWeight<PW> + GetLayer,
|
SW: AccessSegWeight + Into<PW> + GetLayer,
|
||||||
BW: AccessBendWeight<PW> + GetLayer,
|
BW: AccessBendWeight + Into<PW> + GetLayer,
|
||||||
CW: Copy,
|
CW: Copy,
|
||||||
PI: GetPetgraphIndex + TryInto<DI> + TryInto<SI> + TryInto<BI> + PartialEq + Copy,
|
PI: GetPetgraphIndex + TryInto<DI> + TryInto<SI> + TryInto<BI> + PartialEq + Copy,
|
||||||
DI: GetPetgraphIndex + Into<PI> + Copy,
|
DI: GetPetgraphIndex + Into<PI> + Copy,
|
||||||
|
|
@ -390,9 +393,9 @@ impl<
|
||||||
|
|
||||||
impl<
|
impl<
|
||||||
PW: GetWidth + GetLayer + TryInto<DW> + TryInto<SW> + TryInto<BW> + Retag<PI> + Copy,
|
PW: GetWidth + GetLayer + TryInto<DW> + TryInto<SW> + TryInto<BW> + Retag<PI> + Copy,
|
||||||
DW: AccessDotWeight<PW> + GetLayer,
|
DW: AccessDotWeight + Into<PW> + GetLayer,
|
||||||
SW: AccessSegWeight<PW> + GetLayer,
|
SW: AccessSegWeight + Into<PW> + GetLayer,
|
||||||
BW: AccessBendWeight<PW> + GetLayer,
|
BW: AccessBendWeight + Into<PW> + GetLayer,
|
||||||
CW: Copy,
|
CW: Copy,
|
||||||
PI: GetPetgraphIndex + TryInto<DI> + TryInto<SI> + TryInto<BI> + PartialEq + Copy,
|
PI: GetPetgraphIndex + TryInto<DI> + TryInto<SI> + TryInto<BI> + PartialEq + Copy,
|
||||||
DI: GetPetgraphIndex + Into<PI> + Copy,
|
DI: GetPetgraphIndex + Into<PI> + Copy,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue