mirror of https://codeberg.org/topola/topola.git
Create and use new enum to later use different master interactors using the same interface
This commit is contained in:
parent
c7430f9fc9
commit
b2ef23c06c
|
|
@ -5,7 +5,7 @@
|
|||
use std::sync::mpsc::{Receiver, Sender, channel};
|
||||
|
||||
use specctra::{error::ParseErrorContext, structure::DsnFile};
|
||||
use topola::Board;
|
||||
use topola::board::Board;
|
||||
use unic_langid::langid;
|
||||
|
||||
use crate::{
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@
|
|||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
|
||||
use crate::{viewport::Viewport, workspace::GuiWorkspace};
|
||||
use topola::primitives::{Joint, Polygon, Segment, Via};
|
||||
use topola::{Orientation, Vector2, Workspace};
|
||||
use topola::{
|
||||
Orientation, Vector2, Workspace,
|
||||
layout::primitives::{Joint, Polygon, Segment, Via},
|
||||
};
|
||||
|
||||
pub struct Display {}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ use std::collections::BTreeMap;
|
|||
|
||||
use egui::{Context, Grid, ScrollArea, SidePanel, widget_text::WidgetText};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use topola::{Board, LayerDesc, LayerId, LayerSide, LayerType};
|
||||
use topola::board::{Board, LayerDesc, LayerSide, LayerType};
|
||||
use topola::layout::LayerId;
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Colors {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
|
||||
use egui::Pos2;
|
||||
use topola::{MasterInteractor, Vector2, Workspace};
|
||||
use topola::{Interactor, MasterInteractor, Vector2, Workspace};
|
||||
|
||||
use crate::{display::Display, menu_bar::MenuBar, translator::Translator, workspace::GuiWorkspace};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use std::{ops::ControlFlow, time::Instant};
|
||||
|
||||
use topola::{Board, Workspace};
|
||||
use topola::{Workspace, board::Board};
|
||||
|
||||
use crate::{layers_panel::LayersPanel, translator::Translator};
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,11 @@ use rand_distr::{Distribution, Normal};
|
|||
use undoredo::{FlushDelta, ResetDelta};
|
||||
|
||||
use crate::{
|
||||
Board, Vector2, board::BoardDelta, layout::compounds::ComponentId, orientation::Orientation,
|
||||
board::{Board, BoardDelta},
|
||||
layout::compounds::ComponentId,
|
||||
orientation::Orientation,
|
||||
selections::ComponentSelection,
|
||||
vector::Vector2,
|
||||
};
|
||||
|
||||
pub struct AutoplacerSchedule {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use derive_getters::Getters;
|
||||
|
||||
use crate::{Board, Ratsnest, router::Router};
|
||||
use crate::{board::Board, ratsnest::Ratsnest, router::Router};
|
||||
|
||||
#[derive(Clone, Debug, Getters)]
|
||||
pub struct Autorouter {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,12 @@
|
|||
//
|
||||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
|
||||
use crate::{Board, Rect2, layout::compounds::ComponentId, selections::ComponentSelection};
|
||||
use crate::{
|
||||
board::Board,
|
||||
layout::compounds::ComponentId,
|
||||
rect::Rect2,
|
||||
selections::ComponentSelection,
|
||||
};
|
||||
|
||||
impl Board {
|
||||
pub fn components_bbox2(&self, selection: ComponentSelection) -> Option<Rect2<i64>> {
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@
|
|||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
|
||||
use crate::{
|
||||
Board, Vector2,
|
||||
primitives::{JointId, PolygonId, SegmentId, ViaId},
|
||||
board::Board,
|
||||
layout::primitives::{JointId, PolygonId, SegmentId, ViaId},
|
||||
selections::{ComponentSelection, NetSelection, NetSelector, PinSelection},
|
||||
vector::Vector2,
|
||||
};
|
||||
|
||||
impl Board {
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@
|
|||
|
||||
use crate::{
|
||||
board::Board,
|
||||
layout::compounds::ComponentId,
|
||||
primitives::{
|
||||
JointId, JointSpec, Polygon, PolygonId, Segment, SegmentId, SegmentSpec, Via, ViaId,
|
||||
ViaSpec,
|
||||
layout::{
|
||||
compounds::ComponentId,
|
||||
primitives::{
|
||||
JointId, JointSpec, Polygon, PolygonId, Segment, SegmentId, SegmentSpec, Via, ViaId,
|
||||
ViaSpec,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,13 @@ use derive_getters::Getters;
|
|||
use derive_more::Constructor;
|
||||
use undoredo::ResetDelta;
|
||||
|
||||
use crate::{Board, LayerId, Vector2, selections::ComponentSelection};
|
||||
use crate::{
|
||||
board::Board,
|
||||
interactor::Interactor,
|
||||
layout::LayerId,
|
||||
selections::ComponentSelection,
|
||||
vector::Vector2,
|
||||
};
|
||||
|
||||
#[derive(Clone, Constructor, Debug, Eq, Getters, PartialEq)]
|
||||
pub struct DragMoveInteractor {
|
||||
|
|
@ -15,18 +21,20 @@ pub struct DragMoveInteractor {
|
|||
selection: ComponentSelection,
|
||||
}
|
||||
|
||||
impl DragMoveInteractor {
|
||||
pub fn hold(&mut self, board: &mut Board, pointer: Vector2<i64>) {
|
||||
impl Interactor for DragMoveInteractor {
|
||||
fn delete(&mut self, _board: &mut Board) {}
|
||||
|
||||
fn hold(&mut self, board: &mut Board, _layer: LayerId, pointer: Vector2<i64>) {
|
||||
board.reset_delta();
|
||||
|
||||
board.move_components_by(self.selection.clone(), pointer - self.origin);
|
||||
}
|
||||
|
||||
pub fn abort(&mut self, board: &mut Board) {
|
||||
board.reset_delta();
|
||||
fn release(&mut self, board: &mut Board, layer: LayerId, pointer: Vector2<i64>) {
|
||||
self.hold(board, layer, pointer);
|
||||
}
|
||||
|
||||
pub fn release(&mut self, board: &mut Board, pointer: Vector2<i64>) {
|
||||
self.hold(board, pointer);
|
||||
fn abort(&mut self, board: &mut Board) {
|
||||
board.reset_delta();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,13 +7,15 @@ use derive_more::Constructor;
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
Rect3, Vector2, Vector3,
|
||||
board::{
|
||||
Board,
|
||||
interactors::{SelectionCombineMode, SelectionContainMode},
|
||||
selections::PersistableSelection,
|
||||
},
|
||||
interactor::Interactor,
|
||||
layout::LayerId,
|
||||
rect::Rect3,
|
||||
vector::{Vector2, Vector3},
|
||||
};
|
||||
|
||||
#[derive(Clone, Constructor, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
|
||||
|
|
@ -46,8 +48,12 @@ impl DragSelectInteractor {
|
|||
options,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn hold(&mut self, board: &Board, pointer: Vector2<i64>) {
|
||||
impl Interactor for DragSelectInteractor {
|
||||
fn delete(&mut self, _board: &mut Board) {}
|
||||
|
||||
fn hold(&mut self, board: &mut Board, _layer: LayerId, pointer: Vector2<i64>) {
|
||||
self.selection = PersistableSelection::new();
|
||||
|
||||
let rect = Rect3::new(
|
||||
|
|
@ -181,7 +187,11 @@ impl DragSelectInteractor {
|
|||
self.selection = combined_selection;
|
||||
}
|
||||
|
||||
pub fn abort(&mut self) {
|
||||
fn release(&mut self, board: &mut Board, layer: LayerId, pointer: Vector2<i64>) {
|
||||
self.hold(board, layer, pointer);
|
||||
}
|
||||
|
||||
fn abort(&mut self, _board: &mut Board) {
|
||||
self.selection = self.original_selection.clone();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,13 +5,14 @@
|
|||
use derive_getters::Getters;
|
||||
|
||||
use crate::{
|
||||
Vector2,
|
||||
board::{
|
||||
Board,
|
||||
interactors::{DragMoveInteractor, SelectInteractor, SelectionCombineMode},
|
||||
selections::PersistableSelection,
|
||||
},
|
||||
interactor::Interactor,
|
||||
layout::LayerId,
|
||||
vector::Vector2,
|
||||
};
|
||||
|
||||
#[derive(Clone, Debug, Eq, Getters, PartialEq)]
|
||||
|
|
@ -29,12 +30,14 @@ impl MasterInteractor {
|
|||
selection,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn delete(&mut self, board: &mut Board) {
|
||||
impl Interactor for MasterInteractor {
|
||||
fn delete(&mut self, board: &mut Board) {
|
||||
board.delete_net_free_primitives(self.selection.nets.clone());
|
||||
}
|
||||
|
||||
pub fn hold(&mut self, board: &mut Board, layer: LayerId, pointer: Vector2<i64>) {
|
||||
fn hold(&mut self, board: &mut Board, layer: LayerId, pointer: Vector2<i64>) {
|
||||
if self.select_interactor.is_none() && self.drag_move_interactor.is_none() {
|
||||
if board.components_contain_point(&self.selection.components, pointer) {
|
||||
self.drag_move_interactor = Some(DragMoveInteractor::new(
|
||||
|
|
@ -52,16 +55,16 @@ impl MasterInteractor {
|
|||
}
|
||||
|
||||
if let Some(drag_move_interactor) = self.drag_move_interactor.as_mut() {
|
||||
drag_move_interactor.hold(board, pointer);
|
||||
drag_move_interactor.hold(board, layer, pointer);
|
||||
} else if let Some(select_interactor) = self.select_interactor.as_mut() {
|
||||
select_interactor.hold(board, layer, pointer);
|
||||
self.selection = select_interactor.selection().clone();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn release(&mut self, board: &mut Board, layer: LayerId, pointer: Vector2<i64>) {
|
||||
fn release(&mut self, board: &mut Board, layer: LayerId, pointer: Vector2<i64>) {
|
||||
if let Some(drag_move_interactor) = self.drag_move_interactor.as_mut() {
|
||||
drag_move_interactor.release(board, pointer);
|
||||
drag_move_interactor.release(board, layer, pointer);
|
||||
} else if let Some(select_interactor) = self.select_interactor.as_mut() {
|
||||
select_interactor.release(board, layer, pointer);
|
||||
self.selection = select_interactor.selection().clone();
|
||||
|
|
@ -71,13 +74,13 @@ impl MasterInteractor {
|
|||
self.drag_move_interactor = None;
|
||||
}
|
||||
|
||||
pub fn abort(&mut self, board: &mut Board) {
|
||||
fn abort(&mut self, board: &mut Board) {
|
||||
if let Some(drag_move_interactor) = self.drag_move_interactor.as_mut() {
|
||||
drag_move_interactor.abort(board);
|
||||
}
|
||||
|
||||
if let Some(select_interactor) = self.select_interactor.as_mut() {
|
||||
select_interactor.abort();
|
||||
select_interactor.abort(board);
|
||||
self.selection = select_interactor.original_selection().clone();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
use derive_getters::Getters;
|
||||
|
||||
use crate::{
|
||||
Vector2, Vector3,
|
||||
board::{
|
||||
Board,
|
||||
interactors::{
|
||||
|
|
@ -13,7 +12,9 @@ use crate::{
|
|||
},
|
||||
selections::PersistableSelection,
|
||||
},
|
||||
interactor::Interactor,
|
||||
layout::LayerId,
|
||||
vector::{Vector2, Vector3},
|
||||
};
|
||||
|
||||
#[derive(Clone, Debug, Eq, Getters, PartialEq)]
|
||||
|
|
@ -37,12 +38,12 @@ impl SelectInteractor {
|
|||
combine,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn abort(&mut self) {
|
||||
self.selection = self.original_selection.clone();
|
||||
}
|
||||
impl Interactor for SelectInteractor {
|
||||
fn delete(&mut self, _board: &mut Board) {}
|
||||
|
||||
pub fn hold(&mut self, board: &Board, layer: LayerId, pointer: Vector2<i64>) {
|
||||
fn hold(&mut self, board: &mut Board, layer: LayerId, pointer: Vector2<i64>) {
|
||||
let contain = if pointer.x >= self.origin.x {
|
||||
SelectionContainMode::Window
|
||||
} else {
|
||||
|
|
@ -53,11 +54,11 @@ impl SelectInteractor {
|
|||
let mut drag_selection_interactor =
|
||||
DragSelectInteractor::new(self.origin, layer, self.original_selection.clone(), options);
|
||||
|
||||
drag_selection_interactor.hold(board, pointer);
|
||||
drag_selection_interactor.hold(board, layer, pointer);
|
||||
self.selection = drag_selection_interactor.selection().clone();
|
||||
}
|
||||
|
||||
pub fn release(&mut self, board: &Board, layer: LayerId, pointer: Vector2<i64>) {
|
||||
fn release(&mut self, board: &mut Board, layer: LayerId, pointer: Vector2<i64>) {
|
||||
if pointer == self.origin {
|
||||
let mut selection = self.original_selection.clone();
|
||||
let point = Vector3::new(pointer.x, pointer.y, layer.index() as i64);
|
||||
|
|
@ -82,4 +83,8 @@ impl SelectInteractor {
|
|||
|
||||
self.hold(board, layer, pointer);
|
||||
}
|
||||
|
||||
fn abort(&mut self, _board: &mut Board) {
|
||||
self.selection = self.original_selection.clone();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,10 @@
|
|||
|
||||
use crate::{
|
||||
board::{Board, selections::ComponentSelection},
|
||||
layout::compounds::ComponentId,
|
||||
primitives::{JointId, PolygonId, SegmentId, ViaId},
|
||||
layout::{
|
||||
compounds::ComponentId,
|
||||
primitives::{JointId, PolygonId, SegmentId, ViaId},
|
||||
},
|
||||
selections::NetSelection,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use crate::{
|
|||
ComponentSelection, ComponentSelector, NetSelector, PinSelection, PinSelector,
|
||||
},
|
||||
},
|
||||
primitives::{JointId, PolygonId, SegmentId, ViaId},
|
||||
layout::primitives::{JointId, PolygonId, SegmentId, ViaId},
|
||||
};
|
||||
|
||||
impl Board {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
//
|
||||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
|
||||
use crate::{Board, selections::NetSelection};
|
||||
use crate::{board::Board, selections::NetSelection};
|
||||
|
||||
impl Board {
|
||||
pub fn delete_net_free_primitives(&mut self, selection: NetSelection) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,12 @@
|
|||
//
|
||||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
|
||||
use crate::{Board, Vector2, layout::compounds::ComponentId, selections::ComponentSelection};
|
||||
use crate::{
|
||||
board::Board,
|
||||
layout::compounds::ComponentId,
|
||||
selections::ComponentSelection,
|
||||
vector::Vector2,
|
||||
};
|
||||
|
||||
impl Board {
|
||||
pub fn move_components_by(&mut self, selection: ComponentSelection, translation: Vector2<i64>) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use polygon_unionfind::UnionFind;
|
||||
|
||||
use crate::Board;
|
||||
use crate::board::Board;
|
||||
|
||||
pub struct Connectivity {
|
||||
joints_unionfind: UnionFind,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,68 @@
|
|||
// SPDX-FileCopyrightText: 2026 Topola contributors
|
||||
//
|
||||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
|
||||
use crate::{
|
||||
board::{
|
||||
Board,
|
||||
interactors::SelectInteractor,
|
||||
selections::PersistableSelection,
|
||||
},
|
||||
layout::LayerId,
|
||||
vector::Vector2,
|
||||
};
|
||||
|
||||
pub trait Interactor {
|
||||
fn delete(&mut self, board: &mut Board);
|
||||
fn hold(&mut self, board: &mut Board, layer: LayerId, pointer: Vector2<i64>);
|
||||
fn release(&mut self, board: &mut Board, layer: LayerId, pointer: Vector2<i64>);
|
||||
fn abort(&mut self, board: &mut Board);
|
||||
}
|
||||
|
||||
pub enum MasterInteractor {
|
||||
Board(crate::board::interactors::MasterInteractor),
|
||||
}
|
||||
|
||||
impl MasterInteractor {
|
||||
pub fn new(selection: PersistableSelection) -> Self {
|
||||
Self::Board(crate::board::interactors::MasterInteractor::new(selection))
|
||||
}
|
||||
|
||||
pub fn selection(&self) -> &PersistableSelection {
|
||||
match self {
|
||||
Self::Board(interactor) => interactor.selection(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn select_interactor(&self) -> &Option<SelectInteractor> {
|
||||
match self {
|
||||
Self::Board(interactor) => interactor.select_interactor(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Interactor for MasterInteractor {
|
||||
fn delete(&mut self, board: &mut Board) {
|
||||
match self {
|
||||
Self::Board(interactor) => interactor.delete(board),
|
||||
}
|
||||
}
|
||||
|
||||
fn hold(&mut self, board: &mut Board, layer: LayerId, pointer: Vector2<i64>) {
|
||||
match self {
|
||||
Self::Board(interactor) => interactor.hold(board, layer, pointer),
|
||||
}
|
||||
}
|
||||
|
||||
fn release(&mut self, board: &mut Board, layer: LayerId, pointer: Vector2<i64>) {
|
||||
match self {
|
||||
Self::Board(interactor) => interactor.release(board, layer, pointer),
|
||||
}
|
||||
}
|
||||
|
||||
fn abort(&mut self, board: &mut Board) {
|
||||
match self {
|
||||
Self::Board(interactor) => interactor.abort(board),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,8 +3,11 @@
|
|||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
|
||||
use crate::{
|
||||
Layout, Vector2,
|
||||
layout::compounds::{ComponentId, PinId},
|
||||
layout::{
|
||||
Layout,
|
||||
compounds::{ComponentId, PinId},
|
||||
},
|
||||
vector::Vector2,
|
||||
};
|
||||
|
||||
impl Layout {
|
||||
|
|
|
|||
|
|
@ -5,10 +5,9 @@
|
|||
use derive_more::{Constructor, From};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
PinId,
|
||||
layout::primitives::{JointId, PolygonId, SegmentId, ViaId},
|
||||
primitives::PrimitiveId,
|
||||
use crate::layout::{
|
||||
compounds::PinId,
|
||||
primitives::{JointId, PolygonId, PrimitiveId, SegmentId, ViaId},
|
||||
};
|
||||
|
||||
#[derive(
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
use derive_more::{Constructor, From};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::PinId;
|
||||
use crate::layout::compounds::PinId;
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ use derive_more::{Constructor, From};
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
Layout, Vector2,
|
||||
layout::{
|
||||
Layout,
|
||||
compounds::{ComponentId, NetId},
|
||||
primitives::{JointId, PolygonId, SegmentId, ViaId},
|
||||
primitives::{JointId, PolygonId, PrimitiveId, SegmentId, ViaId},
|
||||
},
|
||||
primitives::PrimitiveId,
|
||||
vector::Vector2,
|
||||
};
|
||||
|
||||
#[derive(
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
use rstar::primitives::GeomWithData;
|
||||
|
||||
use crate::{
|
||||
layout::Layout,
|
||||
use crate::layout::{
|
||||
Layout,
|
||||
primitives::{JointId, PolygonId, SegmentId, ViaId},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use rstar::{
|
|||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::primitives::PrimitiveId;
|
||||
use crate::layout::primitives::PrimitiveId;
|
||||
|
||||
use super::Layout;
|
||||
use super::compounds::{ComponentId, NetId, PinId};
|
||||
|
|
|
|||
|
|
@ -4,11 +4,9 @@
|
|||
|
||||
use rstar::primitives::GeomWithData;
|
||||
|
||||
use crate::{
|
||||
layout::{
|
||||
Layout,
|
||||
compounds::{Component, ComponentId, Pin, PinId, PinSpec},
|
||||
},
|
||||
use crate::layout::{
|
||||
Layout,
|
||||
compounds::{Component, ComponentId, Pin, PinId, PinSpec},
|
||||
primitives::{
|
||||
Joint, JointId, JointSpec, Polygon, PolygonId, Segment, SegmentId, SegmentSpec, Via, ViaId,
|
||||
ViaSpec,
|
||||
|
|
|
|||
|
|
@ -5,9 +5,13 @@
|
|||
use std::collections::BTreeSet;
|
||||
|
||||
use crate::{
|
||||
Rect2, Rect3, Vector2, Vector3,
|
||||
layout::{Layout, compounds::NetId},
|
||||
primitives::{JointId, PolygonId, SegmentId, ViaId},
|
||||
layout::{
|
||||
Layout,
|
||||
compounds::NetId,
|
||||
primitives::{JointId, PolygonId, SegmentId, ViaId},
|
||||
},
|
||||
rect::{Rect2, Rect3},
|
||||
vector::{Vector2, Vector3},
|
||||
};
|
||||
|
||||
impl Layout {
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
use rstar::primitives::GeomWithData;
|
||||
|
||||
use crate::{
|
||||
layout::Layout,
|
||||
use crate::layout::{
|
||||
Layout,
|
||||
primitives::{
|
||||
Joint, JointId, JointSpec, Polygon, PolygonId, SegmentId, SegmentSpec, ViaId, ViaSpec,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use derive_more::{Constructor, From};
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::layout::compounds::{ComponentId, NetId, PinId};
|
||||
use crate::primitives::{SegmentId, ViaId};
|
||||
use crate::layout::primitives::{SegmentId, ViaId};
|
||||
use crate::vector::Vector2;
|
||||
use crate::{Rect3, Vector3, layout::LayerId};
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ pub use polygon::*;
|
|||
pub use segment::*;
|
||||
pub use via::*;
|
||||
|
||||
use crate::{Layout, PinId};
|
||||
use crate::layout::{Layout, compounds::PinId};
|
||||
|
||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, From, Ord, PartialEq, PartialOrd, Serialize)]
|
||||
pub enum PrimitiveId {
|
||||
|
|
|
|||
|
|
@ -3,14 +3,15 @@
|
|||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
|
||||
use crate::{
|
||||
Rect2, Vector2,
|
||||
compass::CompassDirection,
|
||||
layout::{
|
||||
Layout,
|
||||
compounds::{ComponentId, PinId},
|
||||
primitives::{JointId, PolygonId, PrimitiveId, SegmentId, ViaId},
|
||||
},
|
||||
orientation::Orientation,
|
||||
primitives::{JointId, PolygonId, PrimitiveId, SegmentId, ViaId},
|
||||
rect::Rect2,
|
||||
vector::Vector2,
|
||||
};
|
||||
|
||||
impl Layout {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,10 @@
|
|||
//
|
||||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
|
||||
use crate::{Layout, layout::compounds::ComponentId, vector::Vector2};
|
||||
use crate::{
|
||||
layout::{Layout, compounds::ComponentId},
|
||||
vector::Vector2,
|
||||
};
|
||||
|
||||
impl Layout {
|
||||
pub fn move_component_by(&mut self, id: ComponentId, translation: Vector2<i64>) {
|
||||
|
|
|
|||
|
|
@ -4,10 +4,11 @@
|
|||
|
||||
mod autoplacer;
|
||||
mod autorouter;
|
||||
mod board;
|
||||
pub mod board;
|
||||
mod compass;
|
||||
mod drawer;
|
||||
mod layout;
|
||||
mod interactor;
|
||||
pub mod layout;
|
||||
mod math;
|
||||
mod navmesher;
|
||||
mod orientation;
|
||||
|
|
@ -20,19 +21,8 @@ mod vector;
|
|||
mod workspace;
|
||||
|
||||
pub use crate::autorouter::Autorouter;
|
||||
pub use crate::board::Board;
|
||||
pub use crate::board::LayerDesc;
|
||||
pub use crate::board::LayerSide;
|
||||
pub use crate::board::LayerType;
|
||||
pub use crate::board::interactors::{
|
||||
DragSelectInteractor, DragSelectOptions, MasterInteractor, SelectInteractor,
|
||||
SelectionCombineMode, SelectionContainMode,
|
||||
};
|
||||
pub use crate::board::selections;
|
||||
pub use crate::layout::LayerId;
|
||||
pub use crate::layout::Layout;
|
||||
pub use crate::layout::compounds::{Pin, PinId};
|
||||
pub use crate::layout::primitives;
|
||||
pub use crate::interactor::{Interactor, MasterInteractor};
|
||||
pub use crate::orientation::Orientation;
|
||||
pub use crate::ratsnest::{Ratline, Ratsnest};
|
||||
pub use crate::rect::{Rect2, Rect3};
|
||||
|
|
|
|||
|
|
@ -10,9 +10,11 @@ use stable_vec::StableVec;
|
|||
use undoredo::Recorder;
|
||||
|
||||
use crate::{
|
||||
Board,
|
||||
layout::LayerId,
|
||||
primitives::{Joint, JointId, JointSpec, Polygon, PolygonId, Segment, SegmentId},
|
||||
board::Board,
|
||||
layout::{
|
||||
LayerId,
|
||||
primitives::{Joint, JointId, JointSpec, Polygon, PolygonId, Segment, SegmentId},
|
||||
},
|
||||
vector::Vector2,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -9,10 +9,12 @@ use serde::{Deserialize, Serialize};
|
|||
use spade::{DelaunayTriangulation, HasPosition, Triangulation, handles::FixedVertexHandle};
|
||||
|
||||
use crate::{
|
||||
Board,
|
||||
layout::LayerId,
|
||||
layout::compounds::NetId,
|
||||
primitives::{JointId, PolygonId, PrimitiveId, SegmentId},
|
||||
board::Board,
|
||||
layout::{
|
||||
LayerId,
|
||||
compounds::NetId,
|
||||
primitives::{JointId, PolygonId, PrimitiveId, SegmentId},
|
||||
},
|
||||
vector::Vector2,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
//
|
||||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
|
||||
use crate::{Board, drawer::Drawer, navmesher::NavmesherBoard, pathfinder::Pathfinder};
|
||||
use crate::{board::Board, drawer::Drawer, navmesher::NavmesherBoard, pathfinder::Pathfinder};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum Router {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use crate::{
|
|||
LayerId,
|
||||
compounds::{ComponentId, NetId, PinId, PinSpec},
|
||||
},
|
||||
primitives::{JointSpec, Polygon, Segment, SegmentSpec},
|
||||
layout::primitives::{JointSpec, Polygon, Segment, SegmentSpec},
|
||||
vector::Vector2,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use undoredo::FlushDelta;
|
||||
|
||||
use crate::{Autorouter, Board, selections::PersistableSelection};
|
||||
use crate::{autorouter::Autorouter, board::Board, selections::PersistableSelection};
|
||||
|
||||
pub enum Workspace {
|
||||
Board(BoardWorkspace),
|
||||
|
|
|
|||
Loading…
Reference in New Issue