/// <summary> /// Action setup constructor /// </summary> public AddObjectAction( object template, ILineIntersection pick, Guid id ) { m_Id = id; m_Instance = CreateInstance( template, pick ); Redo( ); }
public ConfigurationSpacesGrid2D(ILevelDescription <TNode> levelDescription, ILineIntersection <OrthogonalLineGrid2D> lineIntersection = null) { this.levelDescription = levelDescription; this.lineIntersection = lineIntersection ?? new OrthogonalLineIntersection(); configurationSpacesGenerator = new ConfigurationSpacesGenerator(new PolygonOverlap(), DoorHandler.DefaultHandler, this.lineIntersection, new GridPolygonUtils()); Initialize(); }
public ConfigurationSpacesGenerator(IPolygonOverlap <PolygonGrid2D> polygonOverlap, IDoorHandler doorHandler, ILineIntersection <OrthogonalLineGrid2D> lineIntersection, IPolygonUtils <PolygonGrid2D> polygonUtils) { this.polygonOverlap = polygonOverlap; this.doorHandler = doorHandler; this.lineIntersection = lineIntersection; this.polygonUtils = polygonUtils; }
/// <summary> /// ConfigurationSpaces constructor. /// </summary> /// <param name="shapes">Shapes for nodes that do not have any shapes specified.</param> /// <param name="shapesForNodes">Shapes for nodes that should not use default shapes.</param> /// <param name="configurationSpaces"></param> /// <param name="lineIntersection"></param> public ConfigurationSpaces( List <WeightedShape> shapes, List <WeightedShape>[] shapesForNodes, ConfigurationSpace[][] configurationSpaces, ILineIntersection <OrthogonalLine> lineIntersection) : base(lineIntersection) { Shapes = shapes; ShapesForNodes = shapesForNodes; ConfigurationSpaces_ = configurationSpaces; }
private static object CreateInstance( object template, ILineIntersection pick ) { object instance = CreateInstance( template ); IPlaceableObjectEditor placeable = instance as IPlaceableObjectEditor; if ( placeable != null ) { placeable.Place( pick ); } return instance; }
/// <summary> /// Places this object at a line intersection /// </summary> public void Place( ILineIntersection intersection ) { Point3 pt = ( ( Line3Intersection )intersection ).IntersectionPosition; m_PositionModifier = new PositionModifier( this, pt ); m_PositionModifier.Changed += delegate { m_AngleModifier.Centre = m_PositionModifier.Position; OnObjectChanged( ); }; m_AngleModifier = new AngleModifier( this, pt, 0 ); m_AngleModifier.Changed += delegate { OnObjectChanged( ); }; AddModifier( m_AngleModifier ); AddModifier( m_PositionModifier ); }
public ConfigurationSpaces( ILineIntersection <OrthogonalLineGrid2D> lineIntersection, int roomTemplateInstancesCount, int nodesCount, Func <TConfiguration, TConfiguration, int> configurationSpaceSelector) : base(lineIntersection) { this.configurationSpaceSelector = configurationSpaceSelector; // Init configuration spaces array ConfigurationSpaces_ = new ConfigurationSpace[roomTemplateInstancesCount][][]; for (var i = 0; i < roomTemplateInstancesCount; i++) { ConfigurationSpaces_[i] = new ConfigurationSpace[roomTemplateInstancesCount][]; } // Init shapes for node lists ShapesForNodes = new List <List <WeightedShape> >(nodesCount); for (var i = 0; i < nodesCount; i++) { ShapesForNodes.Add(new List <WeightedShape>()); } }
/// <summary> /// Called when the pick info changes /// </summary> /// <param name="lastPick">Last pick information</param> /// <param name="curPick">Current pick information</param> public void PickChanged( ILineIntersection lastPick, ILineIntersection curPick ) { if ( lastPick is Line3Intersection ) { Line3Intersection lastPick3 = ( Line3Intersection )lastPick; Line3Intersection curPick3 = ( Line3Intersection )curPick; Vector3 delta = curPick3.IntersectionPosition - lastPick3.IntersectionPosition; if ( delta.SqrLength > 0 ) { m_InputPos = curPick3.IntersectionPosition; TurnObjects( m_InputPos ); } } else { throw new NotImplementedException( string.Format( "Unhandled pick type \"{0}\"", lastPick.GetType( ) ) ); } }
/// <summary> /// Creates the action appropriate for this object /// </summary> /// <param name="pick">Pick information</param> /// <returns>Returns a move action</returns> public IPickAction CreatePickAction( ILineIntersection pick ) { // TODO: AP: Correct move action parameters return new MoveAction( new RayCastOptions( RayCastLayers.StaticGeometry ) ); }
protected AbstractConfigurationSpaces(ILineIntersection <OrthogonalLine> lineIntersection) { LineIntersection = lineIntersection; }
/// <summary> /// Creates the action appropriate for this object /// </summary> /// <param name="pick">Pick information</param> /// <returns>Returns a move action</returns> public IPickAction CreatePickAction( ILineIntersection pick ) { return new MoveAction( new RayCastOptions( RayCastLayers.Grid ) ); }
private void OnMouseMove( object sender, MouseEventArgs args ) { IPicker picker = ( IPicker )sender; ILineIntersection pick = picker.FirstPick( args.X, args.Y, null ); if ( m_LastHighlit != null ) { m_LastHighlit.Highlighted = false; m_LastHighlit = null; } if ( ( pick != null ) && ( CurrentPickOptions.TestObject( pick ) ) ) { if ( ( ( args.Button & m_ActionButton ) == 0 ) || ( !UsingPickAction ) ) { m_LastHighlit = pick.IntersectedObject as ISelectable; if ( m_LastHighlit != null ) { m_LastHighlit.Highlighted = true; } } else { m_PickAction.PickChanged( m_CursorPick, pick ); } } m_LastCursorPick = m_CursorPick; m_CursorPick = pick; }