You can subscribe to this list here.
2007 |
Jan
|
Feb
(1) |
Mar
(6) |
Apr
(7) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(10) |
Oct
(9) |
Nov
|
Dec
|
---|
From: Jon S. B. <jb...@us...> - 2007-04-14 06:02:54
|
Update of /cvsroot/jsbsimcommander/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv727/src Modified Files: commander.rc Log Message: More refinements to the actuator dialog Index: commander.rc =================================================================== RCS file: /cvsroot/jsbsimcommander/src/commander.rc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** commander.rc 23 Feb 2007 04:06:10 -0000 1.3 --- commander.rc 14 Apr 2007 06:02:48 -0000 1.4 *************** *** 100,101 **** --- 100,102 ---- pid BITMAP "pid.bmp" sensor BITMAP "sensor.bmp" + actuator BITMAP "actuator.bmp" |
From: Jon S. B. <jb...@us...> - 2007-04-13 04:14:23
|
Update of /cvsroot/jsbsimcommander/src/gui In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv10846 Added Files: actuator.cpp actuator.h actuator_dlg.cpp actuator_dlg.h Log Message: Early, non-working, version of actuator dialog. --- NEW FILE: actuator.cpp --- ///////////////////////////////////////////////////////////////////////////// // Name: actuator.cpp // Purpose: support FGActuator in FCSBuilder // Author: Jon Berndt // Created: 06/02/2006 // Copyright: (c) Jon Berndt // Licence: GPL licence // // Functions: // // Actuator - Constructor // OnDraw // Copy // ExportXML // ImportXML // ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ // #pragma implementation #endif // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #include <wx/wx.h> #endif #include "wx/deprecated/setup.h" #if wxUSE_PROLOGIO #include "wx/deprecated/wxexpr.h" #endif #include "wx/ogl/ogl.h" #include "FGXMLElement.h" #include "MyApp.h" #include "shape.h" #include "actuator.h" IMPLEMENT_DYNAMIC_CLASS (Actuator, ComponentShape) /** * Actuator Constructor =========================================================== */ Actuator::Actuator (double w, double h, const wxString & Name ) :ComponentShape(w, h, wxT("actuator"), Name), Noise(0.0) { SetAttachmentMode (ATTACHMENT_MODE_EDGE); ClearAttachments (); GetAttachments ().Append (new wxAttachmentPoint (0, w * 0.5, 0.0)); GetAttachments ().Append (new wxAttachmentPoint (1, -w * 0.5, 0.0)); // input_sign_list.Append(new bool(false)); InputIsInverted = false; } /** * OnDraw ======================================================================= */ void Actuator::OnDraw (wxDC & dc) { ComponentShape::OnDraw (dc); wxCoord h,w; h = (int)m_height/2-arr_size - 2; w = (int)m_width/2 - 2; wxCoord r = h<w?h:w; r = r<10?r:10; wxPoint c[2]; c[0].y = 0; c[0].x = 3-w; c[1].y = 0; c[1].x = 3+w; dc.DrawLines (2, c, WXROUND (m_xpos), WXROUND (m_ypos)); // left vertical c[0].y = -4*h/5; c[0].x = -3*w/5; c[1].y = 4*h/5; c[1].x = -3*w/5; dc.DrawLines (2, c, WXROUND (m_xpos), WXROUND (m_ypos)); // top horizontal c[0].y = -4*h/5; c[0].x = -3*w/5; c[1].y = -4*h/5; c[1].x = 3*w/5; dc.DrawLines (2, c, WXROUND (m_xpos), WXROUND (m_ypos)); // bottom horizontal c[0].y = 4*h/5; c[0].x = -3*w/5; c[1].y = 4*h/5; c[1].x = 3*w/5+1; dc.DrawLines (2, c, WXROUND (m_xpos), WXROUND (m_ypos)); // right vertical c[0].y = -4*h/5; c[0].x = 3*w/5; c[1].y = 4*h/5; c[1].x = 3*w/5; dc.DrawLines (2, c, WXROUND (m_xpos), WXROUND (m_ypos)); dc.SetPen(*wxBLACK_PEN); dc.SetBrush(*wxRED_BRUSH); dc.DrawRoundedRectangle(WXROUND (m_xpos)-w/5-1, WXROUND (m_ypos)-h, 2*w/5+2, 6*h/10, -0.2); dc.SetBrush(*wxGREEN_BRUSH); dc.DrawRoundedRectangle(WXROUND (m_xpos)-w/5-1, WXROUND (m_ypos)-3*h/10+1, 2*w/5+2, 6*h/10, -0.2); dc.SetBrush(*wxBLUE_BRUSH); dc.DrawRoundedRectangle(WXROUND (m_xpos)-w/5-1, WXROUND (m_ypos)+4*h/10+2, 2*w/5+2, 6*h/10, -0.2); } /** * ======================================================================= */ #if wxUSE_PROLOGIO void Actuator::WriteAttributes (wxExpr * clause) { ComponentShape::WriteAttributes (clause); } void Actuator::ReadAttributes (wxExpr * clause) { ComponentShape::ReadAttributes (clause); } #endif /** * Copy ========================================================================= */ void Actuator::Copy (wxShape & copy) { ComponentShape::Copy (copy); wxASSERT (copy.IsKindOf (CLASSINFO (Actuator))); Actuator & ActuatorCopy = (Actuator &) copy; } /** * ExportXML ==================================================================== */ void Actuator::ExportXML(wxTextOutputStream & stream, const wxString & prefix) { ExportHead(stream, prefix); wxString Pre = prefix + wxT(" "); ExportInputs(stream,Pre); if (Lag != 0.0) stream << Pre << wxT("<lag> ") << Lag << wxT(" </lag>") << endl; if (Rate_Limit != 0.0) stream << Pre << wxT("<rate_limit> ") << Rate_Limit << wxT(" </rate_limit>") << endl; if (Bias != 0.0) stream << Pre << wxT("<bias> ") << Bias << wxT(" </bias>") << endl; if (Hysteresis_Width != 0.0) stream << Pre << wxT("<hysteresis_width> ") << Hysteresis_Width << wxT(" </hysteresis_width>") << endl; ExportCliper(stream,Pre); ExportOutput(stream,Pre); ExportTail(stream, prefix); } /** * ImportXML ==================================================================== <actuator name=name> <input> {[-]property} </input> <lag> number </lag> <rate_limit> number <rate_limit> <bias> number </bias> <deadband_width> number </deadband_width> // not modeled now <hysteresis_width> number </hysteresis_width> [<clipto> <min> {property name | value} </min> <max> {property name | value} </max> </clipto>] [<output> {property} </output>] </actuator> */ wxArrayString Actuator::ImportXML(JSBSim::Element * el) { JSBSim::Element* scratch_element=0; wxArrayString strings = ComponentShape::ImportXML(el); if ( el->FindElement("lag") ) Lag = el->FindElementValueAsNumber("lag"); if ( el->FindElement("rate_limit")) Rate_Limit = el->FindElementValueAsNumber("rate_limit"); if ( el->FindElement("bias")) Bias = el->FindElementValueAsNumber("bias"); if ( el->FindElement("hysteresis_width")) Hysteresis_Width = el->FindElementValueAsNumber("hysteresis_width"); InputIsInverted = *((GetInputSignList().Item(0))->GetData()); return strings; } --- NEW FILE: actuator_dlg.h --- ///////////////////////////////////////////////////////////////////////////// // Name: actuator_dlg.h // Purpose: dialog for FGActuator // Author: Jon Berndt // Created: 04/12/2007 // Copyright: (c) Jon Berndt // Licence: GPL licence ///////////////////////////////////////////////////////////////////////////// // -*- C++ -*- generated by wxGlade 0.4.1 on Fri Apr 06 07:40:41 2007 #include <wx/wx.h> #include <wx/image.h> // begin wxGlade: ::dependencies #include <wx/notebook.h> #include <wx/tglbtn.h> // end wxGlade #ifndef ACTUATORCOMPONENTEDITOR_H #define ACTUATORCOMPONENTEDITOR_H class Actuator; class ActuatorComponentEditor: public wxDialog { public: // begin wxGlade: ActuatorComponentEditor::ids // end wxGlade ActuatorComponentEditor(Actuator *actuator, wxWindow* parent, int id, const wxString& title, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE); private: // begin wxGlade: ActuatorComponentEditor::methods void set_properties(); void do_layout(); // end wxGlade protected: // begin wxGlade: ActuatorComponentEditor::attributes wxStaticBox* sizer_inout_staticbox; wxStaticBox* sizer_actuator_properties_staticbox; wxStaticBox* sizer_clip_staticbox; wxStaticBox* sizer_basic_staticbox; wxStaticText* label_name; wxTextCtrl* txtEd_Name; wxStaticText* label_type; wxTextCtrl* txtEd_Type; wxStaticText* label_order; wxTextCtrl* txtEd_Order; wxCheckBox* chx_Clip; wxStaticText* label_clip_min; wxTextCtrl* txtEd_MinClip; wxStaticText* label_clip_max; wxTextCtrl* txtEd_MaxClip; wxStaticText* label_7; wxTextCtrl* txtEd_Lag; wxStaticText* label_10; wxTextCtrl* txtEd_RateLimit; wxStaticText* label_11; wxTextCtrl* txtEd_Hysteresis; wxStaticText* label_17; wxTextCtrl* txtEd_Bias; wxStaticText* label_1; wxToggleButton* button_invert_input; wxTextCtrl* txtEd_InputProperty; wxStaticText* label_output_property; wxTextCtrl* txtEd_OutputProperty; wxPanel* notebook_1_pane_1; wxTextCtrl* txtEd_Description; wxNotebook* nbk_Properties; wxButton* button_OK; wxButton* button_Cancel; wxButton* button_Help; // end wxGlade DECLARE_EVENT_TABLE(); public: void OnCheckboxClip(wxCommandEvent &event); // wxGlade: <event_handler> void OnClickInvertInput(wxCommandEvent &event); // wxGlade: <event_handler> void OnButtonPressOK(wxCommandEvent &event); // wxGlade: <event_handler> void OnButtonPressCancel(wxCommandEvent &event); // wxGlade: <event_handler> void OnButtonPressHelp(wxCommandEvent &event); // wxGlade: <event_handler> }; // wxGlade: end class #endif // ACTUATORCOMPONENTEDITOR_H --- NEW FILE: actuator.h --- ///////////////////////////////////////////////////////////////////////////// // Name: actuator.h // Purpose: shape for FGActuator // Author: Jon Berndt // Created: 07/18/2006 // Copyright: (c) Jon Berndt // Licence: GPL licence ///////////////////////////////////////////////////////////////////////////// #ifndef _FCSBUILDER_ACTUATOR_H_ #define _FCSBUILDER_ACTUATOR_H_ #if defined(__GNUG__) && !defined(__APPLE__) // #pragma interface #endif /* * FGActuator Componment */ class Actuator: public ComponentShape { DECLARE_DYNAMIC_CLASS (Actuator) protected: double Lag; double Bias; double Rate_Limit; double Hysteresis_Width; // double Deadband_Width; bool InputIsInverted; public: Actuator (double w = 0.0, double h = 0.0, const wxString & Name = wxT("actuator")); void OnDraw (wxDC & dc); #if wxUSE_PROLOGIO void WriteAttributes (wxExpr * clause); void ReadAttributes (wxExpr * clause); #endif virtual void ExportXML(wxTextOutputStream & stream, const wxString & prefix); virtual wxArrayString ImportXML(JSBSim::Element * el); // Does the copying for this object void Copy (wxShape & copy); double GetLag(void) const {return Lag;} double GetBias(void) const {return Bias;} double GetRate_Limit(void) const {return Rate_Limit;} double GetHysteresis_Width(void) const {return Hysteresis_Width;} // double GetDeadband_Width(void) const {return Deadband_Width;} void SetLag(const double n) {Lag = n;} void SetBias(const double n) {Bias = n;} void SetRate_Limit(const double n) {Rate_Limit = n;} void SetHysteresis_Width(const double n) {Hysteresis_Width = n;} // void SetDeadband_Width(const double & n) {Deadband_Width = n;} inline bool GetInputIsInverted(void) {return InputIsInverted;} inline void SetInputIsInverted(bool s) {InputIsInverted = s;} }; #endif // _FCSBUILDER_ACTUATOR_H_ --- NEW FILE: actuator_dlg.cpp --- ///////////////////////////////////////////////////////////////////////////// // Name: actuator_dlg.cpp // Purpose: dialog for FGActuator // Author: Jon Berndt // Created: 04/12/2007 // Copyright: (c) Jon Berndt // Licence: GPL licence // // Functions: // // do_layout // GetDataIn // OnButtonPressCancel // OnButtonPressHelp // OnButtonPressOK // OnCheckboxClip // OnButtonPressCancel // OnButtonPressHelp // OnClickInvertInput // SensorComponentEditor - Constructor // set_properties // SetDataOut // Show // ///////////////////////////////////////////////////////////////////////////// // -*- C++ -*- generated by wxGlade 0.4.1 on Fri Apr 06 07:40:41 2007 #include "actuator_dlg.h" ActuatorComponentEditor::ActuatorComponentEditor(Actuator *actuator, wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long style): wxDialog(parent, id, title, pos, size, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxTHICK_FRAME|wxSTAY_ON_TOP|wxFULL_REPAINT_ON_RESIZE) { // begin wxGlade: ActuatorComponentEditor::ActuatorComponentEditor nbk_Properties = new wxNotebook(this, -1, wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER|wxTAB_TRAVERSAL|wxWS_EX_VALIDATE_RECURSIVELY); notebook_1_pane_1 = new wxPanel(nbk_Properties, -1); sizer_clip_staticbox = new wxStaticBox(notebook_1_pane_1, -1, wxT("Clipping")); sizer_actuator_properties_staticbox = new wxStaticBox(notebook_1_pane_1, -1, wxT("Actuator Properties")); sizer_inout_staticbox = new wxStaticBox(notebook_1_pane_1, -1, wxT("Input / Output")); sizer_basic_staticbox = new wxStaticBox(notebook_1_pane_1, -1, wxT("Basic Properties")); label_name = new wxStaticText(notebook_1_pane_1, -1, wxT("Name:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); txtEd_Name = new wxTextCtrl(notebook_1_pane_1, -1, wxT("")); label_type = new wxStaticText(notebook_1_pane_1, -1, wxT("Type:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); txtEd_Type = new wxTextCtrl(notebook_1_pane_1, -1, wxT("Actuator Component"), wxDefaultPosition, wxDefaultSize, wxTE_READONLY); label_order = new wxStaticText(notebook_1_pane_1, -1, wxT("Order:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); txtEd_Order = new wxTextCtrl(notebook_1_pane_1, -1, wxT("")); chx_Clip = new wxCheckBox(notebook_1_pane_1, -1, wxT("Clip")); label_clip_min = new wxStaticText(notebook_1_pane_1, -1, wxT("Minimum:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); txtEd_MinClip = new wxTextCtrl(notebook_1_pane_1, -1, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_READONLY); label_clip_max = new wxStaticText(notebook_1_pane_1, -1, wxT("Maximum:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); txtEd_MaxClip = new wxTextCtrl(notebook_1_pane_1, -1, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_READONLY); label_7 = new wxStaticText(notebook_1_pane_1, -1, wxT("Lag")); txtEd_Lag = new wxTextCtrl(notebook_1_pane_1, -1, wxT("")); label_10 = new wxStaticText(notebook_1_pane_1, -1, wxT("Rate limit")); txtEd_RateLimit = new wxTextCtrl(notebook_1_pane_1, -1, wxT("")); label_11 = new wxStaticText(notebook_1_pane_1, -1, wxT("Hysteresis")); txtEd_Hysteresis = new wxTextCtrl(notebook_1_pane_1, -1, wxT("")); label_17 = new wxStaticText(notebook_1_pane_1, -1, wxT("Bias")); txtEd_Bias = new wxTextCtrl(notebook_1_pane_1, -1, wxT("")); label_1 = new wxStaticText(notebook_1_pane_1, -1, wxT("Input Property:")); button_invert_input = new wxToggleButton(notebook_1_pane_1, -1, wxT("+")); txtEd_InputProperty = new wxTextCtrl(notebook_1_pane_1, -1, wxT("")); label_output_property = new wxStaticText(notebook_1_pane_1, -1, wxT("Output Property:")); txtEd_OutputProperty = new wxTextCtrl(notebook_1_pane_1, -1, wxT("")); txtEd_Description = new wxTextCtrl(nbk_Properties, -1, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER|wxTE_PROCESS_TAB|wxTE_MULTILINE|wxTE_WORDWRAP); button_OK = new wxButton(this, -1, wxT("OK")); button_Cancel = new wxButton(this, -1, wxT("Cancel")); button_Help = new wxButton(this, -1, wxT("Help")); set_properties(); do_layout(); // end wxGlade GetDataIn(actuator); } BEGIN_EVENT_TABLE(ActuatorComponentEditor, wxDialog) // begin wxGlade: ActuatorComponentEditor::event_table EVT_CHECKBOX(-1, ActuatorComponentEditor::OnCheckboxClip) EVT_TOGGLEBUTTON(-1, ActuatorComponentEditor::OnClickInvertInput) EVT_BUTTON(-1, ActuatorComponentEditor::OnButtonPressOK) EVT_BUTTON(-1, ActuatorComponentEditor::OnButtonPressCancel) EVT_BUTTON(-1, ActuatorComponentEditor::OnButtonPressHelp) // end wxGlade END_EVENT_TABLE(); void ActuatorComponentEditor::OnCheckboxClip(wxCommandEvent &event) { event.Skip(); } void ActuatorComponentEditor::OnClickInvertInput(wxCommandEvent &event) { event.Skip(); } void ActuatorComponentEditor::OnButtonPressOK(wxCommandEvent &event) { if (nbk_Properties->Validate()) nbk_Properties->TransferDataFromWindow(); event.Skip(); } void ActuatorComponentEditor::OnButtonPressCancel(wxCommandEvent &event) { event.Skip(); } void ActuatorComponentEditor::OnButtonPressHelp(wxCommandEvent &event) { event.Skip(); } // wxGlade: add ActuatorComponentEditor event handlers void ActuatorComponentEditor::set_properties() { // begin wxGlade: ActuatorComponentEditor::set_properties SetTitle(wxT("Actuator Component Editor")); txtEd_Name->SetToolTip(wxT("This is the name of the component. It can be a property name, or a human readable name, such as \"Pitch Feedback PID Control\". In the latter case, the name will be converted internally to a property name. In the given example, this will be \"fcs/pitch-feedback-pid-control\".")); txtEd_Name->SetFocus(); txtEd_Type->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTION)); txtEd_Order->SetToolTip(wxT("This number represents the order in which the component will be \"executed\".")); label_clip_min->SetMinSize(wxSize(60, -1)); txtEd_MinClip->SetMinSize(wxSize(100,-1)); txtEd_MinClip->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTION)); txtEd_MinClip->SetToolTip(wxT("This is the minimum value allowed for the component output. ")); label_clip_max->SetMinSize(wxSize(60, -1)); txtEd_MaxClip->SetMinSize(wxSize(100,-1)); txtEd_MaxClip->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTION)); txtEd_MaxClip->SetToolTip(wxT("This is the maximum value allowed for the component output. ")); button_invert_input->SetMinSize(wxSize(21, 21)); button_invert_input->SetToolTip(wxT("Depress this button to invert the input property.")); button_invert_input->Enable(false); txtEd_InputProperty->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTION)); txtEd_InputProperty->SetToolTip(wxT("This is the input property to the component. This is selected via connecting up the components in the editor.")); txtEd_OutputProperty->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTION)); txtEd_OutputProperty->SetToolTip(wxT("This is the output property to the component. This is selected via connecting up the components in the editor.")); button_OK->SetToolTip(wxT("Clicking this button will save the changes made.")); button_Cancel->SetToolTip(wxT("Clicking on the Cancel button will abandon changes made.")); // end wxGlade } void ActuatorComponentEditor::do_layout() { // begin wxGlade: ActuatorComponentEditor::do_layout wxFlexGridSizer* grid_sizer_toplevel = new wxFlexGridSizer(2, 1, 5, 0); wxBoxSizer* sizer_buttons = new wxBoxSizer(wxHORIZONTAL); wxFlexGridSizer* grid_sizer_2 = new wxFlexGridSizer(5, 1, 5, 0); wxStaticBoxSizer* sizer_inout = new wxStaticBoxSizer(sizer_inout_staticbox, wxHORIZONTAL); wxFlexGridSizer* grid_sizer_inout = new wxFlexGridSizer(2, 2, 5, 5); wxFlexGridSizer* grid_sizer_1 = new wxFlexGridSizer(1, 2, 0, 2); wxStaticBoxSizer* sizer_actuator_properties = new wxStaticBoxSizer(sizer_actuator_properties_staticbox, wxVERTICAL); wxGridSizer* grid_sizer_7 = new wxGridSizer(4, 2, 3, 3); wxStaticBoxSizer* sizer_clip = new wxStaticBoxSizer(sizer_clip_staticbox, wxHORIZONTAL); wxFlexGridSizer* grid_sizer_clip = new wxFlexGridSizer(2, 2, 5, 10); wxBoxSizer* sizer_clip_min = new wxBoxSizer(wxHORIZONTAL); wxStaticBoxSizer* sizer_basic = new wxStaticBoxSizer(sizer_basic_staticbox, wxHORIZONTAL); wxFlexGridSizer* grid_sizer_basic_interior = new wxFlexGridSizer(3, 2, 5, 5); grid_sizer_basic_interior->Add(label_name, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 0); grid_sizer_basic_interior->Add(txtEd_Name, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 0); grid_sizer_basic_interior->Add(label_type, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 0); grid_sizer_basic_interior->Add(txtEd_Type, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 0); grid_sizer_basic_interior->Add(label_order, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 0); grid_sizer_basic_interior->Add(txtEd_Order, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxFIXED_MINSIZE, 0); grid_sizer_basic_interior->AddGrowableCol(1); sizer_basic->Add(grid_sizer_basic_interior, 1, wxEXPAND|wxADJUST_MINSIZE, 0); grid_sizer_2->Add(sizer_basic, 1, wxEXPAND|wxADJUST_MINSIZE, 0); grid_sizer_clip->Add(chx_Clip, 0, wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 0); sizer_clip_min->Add(label_clip_min, 0, wxLEFT|wxRIGHT|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5); sizer_clip_min->Add(txtEd_MinClip, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxFIXED_MINSIZE, 0); sizer_clip_min->Add(label_clip_max, 0, wxLEFT|wxRIGHT|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5); sizer_clip_min->Add(txtEd_MaxClip, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxFIXED_MINSIZE, 0); grid_sizer_clip->Add(sizer_clip_min, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 0); grid_sizer_clip->AddGrowableCol(1); sizer_clip->Add(grid_sizer_clip, 1, wxEXPAND|wxADJUST_MINSIZE, 0); grid_sizer_2->Add(sizer_clip, 1, wxEXPAND|wxADJUST_MINSIZE, 0); grid_sizer_7->Add(label_7, 0, wxADJUST_MINSIZE, 0); grid_sizer_7->Add(txtEd_Lag, 0, wxADJUST_MINSIZE, 0); grid_sizer_7->Add(label_10, 0, wxADJUST_MINSIZE, 0); grid_sizer_7->Add(txtEd_RateLimit, 0, wxADJUST_MINSIZE, 0); grid_sizer_7->Add(label_11, 0, wxADJUST_MINSIZE, 0); grid_sizer_7->Add(txtEd_Hysteresis, 0, wxADJUST_MINSIZE, 0); grid_sizer_7->Add(label_17, 0, wxADJUST_MINSIZE, 0); grid_sizer_7->Add(txtEd_Bias, 0, wxADJUST_MINSIZE, 0); sizer_actuator_properties->Add(grid_sizer_7, 1, wxEXPAND, 0); grid_sizer_2->Add(sizer_actuator_properties, 1, wxEXPAND|wxADJUST_MINSIZE, 0); grid_sizer_inout->Add(label_1, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 0); grid_sizer_1->Add(button_invert_input, 0, wxADJUST_MINSIZE, 0); grid_sizer_1->Add(txtEd_InputProperty, 0, wxEXPAND|wxADJUST_MINSIZE, 0); grid_sizer_1->AddGrowableCol(1); grid_sizer_inout->Add(grid_sizer_1, 1, wxEXPAND, 0); grid_sizer_inout->Add(label_output_property, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 0); grid_sizer_inout->Add(txtEd_OutputProperty, 0, wxEXPAND|wxADJUST_MINSIZE, 0); grid_sizer_inout->AddGrowableCol(1); sizer_inout->Add(grid_sizer_inout, 1, wxEXPAND, 0); grid_sizer_2->Add(sizer_inout, 1, wxEXPAND, 0); notebook_1_pane_1->SetAutoLayout(true); notebook_1_pane_1->SetSizer(grid_sizer_2); grid_sizer_2->Fit(notebook_1_pane_1); grid_sizer_2->SetSizeHints(notebook_1_pane_1); grid_sizer_2->AddGrowableCol(0); nbk_Properties->AddPage(notebook_1_pane_1, wxT("Properties")); nbk_Properties->AddPage(txtEd_Description, wxT("Comments")); grid_sizer_toplevel->Add(nbk_Properties, 1, wxEXPAND, 0); sizer_buttons->Add(button_OK, 0, wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5); sizer_buttons->Add(button_Cancel, 0, wxLEFT|wxRIGHT, 5); sizer_buttons->Add(button_Help, 0, wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5); grid_sizer_toplevel->Add(sizer_buttons, 1, wxALL|wxALIGN_CENTER_HORIZONTAL, 5); SetAutoLayout(true); SetSizer(grid_sizer_toplevel); grid_sizer_toplevel->Fit(this); grid_sizer_toplevel->SetSizeHints(this); grid_sizer_toplevel->AddGrowableRow(0); grid_sizer_toplevel->AddGrowableCol(0); Layout(); Centre(); // end wxGlade } /** * Show ========================================================================= */ bool ActuatorComponentEditor::Show( bool show) { bool tmp = wxDialog::Show(show); if (show) nbk_Properties->InitDialog(); return tmp; } /** * GetDataIn ==================================================================== */ void ActuatorComponentEditor::GetDataIn(Sensor * g) { //name = g->GetName(); *txtEd_name << g->GetName(); description = g->GetDescription(); order = wxString::Format(wxT("%ld"), g->GetOrder()); clipable = g->IsClipable(); clip_max = g->GetClipMax(); clip_min = g->GetClipMin(); *txtEd_order << order; if (clipable) { txtEd_MaxClip->Enable(true); txtEd_MaxClip->SetBackgroundColour(*wxWHITE); txtEd_MinClip->Enable(true); txtEd_MinClip->SetBackgroundColour(*wxWHITE); } else { txtEd_MaxClip->Enable(false); txtEd_MaxClip->SetBackgroundColour(wxSYS_COLOUR_INACTIVECAPTION); txtEd_MinClip->Enable(false); txtEd_MinClip->SetBackgroundColour(wxSYS_COLOUR_INACTIVECAPTION); } wxArrayString inputs = g->GetInputNames(); txtEd_OutputProperty->SetValue(g->GetOutputName()); /* if (inputs.GetCount() > 0) { if (inputs[0] != wxT("NULL")) { button_invert_input->Enable(); if (g->GetInputIsInverted()) { button_invert_input->SetValue(true); button_invert_input->SetLabel(wxT("-")); } else { button_invert_input->SetValue(false); button_invert_input->SetLabel(wxT("+")); } } text_ctrl_input_prop->SetValue(inputs[0]); } text_ctrl_1->SetValue(g->GetDescription()); */ } /** * SetDataOut =================================================================== */ void ActuatorComponentEditor::SetDataOut(Sensor * g) { g->SetName(txtEd_Name->GetValue()); long int tmpl; order.ToLong(&tmpl); g->SetOrder(tmpl); g->SetClipable(clipable); double tmpd; g->SetClipMax(clip_max); g->SetClipMin(clip_min); g->SetDescription(text_ctrl_1->GetValue()); g->SetInputIsInverted(false); if (text_ctrl_input_prop->GetValue() != wxT("NULL")) // true if input prop is present if (button_invert_input->GetValue()) // true if inverted g->SetInputIsInverted(true); } |
From: Jon S. B. <jb...@us...> - 2007-03-30 04:43:50
|
Update of /cvsroot/jsbsimcommander/src/gui In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv3798/src/gui Modified Files: sensor.h sensor_dlg.cpp Log Message: UPdated/fixed sensor dialog Index: sensor.h =================================================================== RCS file: /cvsroot/jsbsimcommander/src/gui/sensor.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sensor.h 23 Feb 2007 13:11:24 -0000 1.3 --- sensor.h 30 Mar 2007 04:43:47 -0000 1.4 *************** *** 51,55 **** --- 51,74 ---- inline double GetNoise(void) const {return noise_variance;} + inline double GetLag(void) const {return lag;} + inline double GetDriftRate(void) const {return drift_rate;} + inline double GetBias(void) const {return bias;} + inline double GetMax(void) const {return max;} + inline double GetMin(void) const {return min;} + inline int GetNoiseType(void) const {return NoiseType;} + inline int GetBits(void) const {return bits;} + inline int GetQuantized(void) const {return quantized;} + inline wxString GetQuantProperty(void) const {return quant_property;} + inline void SetNoise(const double & n) {noise_variance = n;} + inline void SetLag(double t) {lag = t;} + inline void SetDriftRate(double t) {drift_rate = t;} + inline void SetBias(double t) {bias = t;} + inline void SetMax(double t) {max = t;} + inline void SetMin(double t) {min = t;} + inline void SetNoiseType(int t) {NoiseType = t;} + inline void SetBits(int t) {bits = t;} + inline void SetQuantized(int t) {quantized = t;} + inline void SetQuantProperty(wxString t) {quant_property = t;} inline bool GetInputIsInverted(void) {return InputIsInverted;} Index: sensor_dlg.cpp =================================================================== RCS file: /cvsroot/jsbsimcommander/src/gui/sensor_dlg.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sensor_dlg.cpp 28 Feb 2007 04:48:44 -0000 1.2 --- sensor_dlg.cpp 30 Mar 2007 04:43:47 -0000 1.3 *************** *** 117,120 **** --- 117,122 ---- do_layout(); // end wxGlade + + GetDataIn(sensor); } *************** *** 185,192 **** } - // wxGlade: add SensorComponentEditor event handlers - void SensorComponentEditor::set_properties() { --- 187,192 ---- *************** *** 351,355 **** void SensorComponentEditor::GetDataIn(Sensor * g) { ! name = g->GetName(); description = g->GetDescription(); order = wxString::Format(wxT("%ld"), g->GetOrder()); --- 351,356 ---- void SensorComponentEditor::GetDataIn(Sensor * g) { ! //name = g->GetName(); ! *text_ctrl_name << g->GetName(); description = g->GetDescription(); order = wxString::Format(wxT("%ld"), g->GetOrder()); *************** *** 374,378 **** wxArrayString inputs = g->GetInputNames(); ! *text_ctrl_output_prop << g->GetOutputName(); if (inputs.GetCount() > 0) { --- 375,379 ---- wxArrayString inputs = g->GetInputNames(); ! text_ctrl_output_prop->SetValue(g->GetOutputName()); if (inputs.GetCount() > 0) { *************** *** 388,394 **** } } ! *text_ctrl_input_prop << inputs[0]; } ! *text_ctrl_1 << g->GetDescription(); } --- 389,406 ---- } } ! text_ctrl_input_prop->SetValue(inputs[0]); } ! text_ctrl_1->SetValue(g->GetDescription()); ! ! radio_box_noise_type->SetSelection(g->GetNoiseType()); ! text_ctrl_2->SetValue(""); *text_ctrl_2 << g->GetNoise(); ! text_ctrl_lag->SetValue(""); *text_ctrl_lag << g->GetLag(); ! text_ctrl_4->SetValue(""); *text_ctrl_4 << g->GetDriftRate(); ! text_ctrl_4_1->SetValue(""); *text_ctrl_4_1 << g->GetBias(); ! text_ctrl_7->SetValue(""); *text_ctrl_7 << g->GetMax(); ! text_ctrl_6->SetValue(""); *text_ctrl_6 << g->GetMin(); ! slider_1->SetValue(g->GetBits()); ! //g->GetQuantized(); ! text_ctrl_5->SetValue(""); *text_ctrl_5 << g->GetQuantProperty(); } *************** *** 399,404 **** void SensorComponentEditor::SetDataOut(Sensor * g) { ! g->SetName(name); ! // g->SetDescription(description); long int tmpl; --- 411,415 ---- void SensorComponentEditor::SetDataOut(Sensor * g) { ! g->SetName(text_ctrl_name->GetValue()); long int tmpl; *************** *** 416,419 **** --- 427,444 ---- if (button_invert_input->GetValue()) // true if inverted g->SetInputIsInverted(true); + + g->SetQuantProperty(text_ctrl_5->GetValue()); + double tmp; + text_ctrl_lag->GetValue().ToDouble(&tmp); + g->SetLag(tmp); + text_ctrl_4->GetValue().ToDouble(&tmp); + g->SetDriftRate(tmp); + text_ctrl_4_1->GetValue().ToDouble(&tmp); + g->SetBias(tmp); + text_ctrl_7->GetValue().ToDouble(&tmp); + g->SetMax(tmp); + text_ctrl_6->GetValue().ToDouble(&tmp); + g->SetMin(tmp); + g->SetNoiseType(radio_box_noise_type->GetSelection()); } |
From: Matthew G. <mat...@us...> - 2007-03-04 08:14:05
|
Update of /cvsroot/jsbsimcommander/src/gui In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv29022/src/gui Modified Files: doc.cpp Log Message: Add new function: If a component is deleted and there is only one input and one output, the previous and next component be connected automatically. Index: doc.cpp =================================================================== RCS file: /cvsroot/jsbsimcommander/src/gui/doc.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** doc.cpp 24 Feb 2007 18:39:08 -0000 1.9 --- doc.cpp 4 Mar 2007 08:13:57 -0000 1.10 *************** *** 474,485 **** if (shape) { ! shape->Select (false); ! // Generate commands to explicitly remove each connected line. ! RemoveLines (shape); ! GetActiveDiagram()->RemoveShape (shape); ! shape->Unlink (); ! shape->GetCanvas ()->Refresh (); } } --- 474,518 ---- if (shape) { ! shape->Select (false); ! // Generate commands to explicitly remove each connected line. ! MISOShape * cshape = wxDynamicCast( shape, MISOShape); ! if (cshape && cshape->GetLines().GetCount() > 1) ! { ! wxObjectList::compatibility_iterator node = cshape->GetLines ().GetFirst (); ! wxLineShape *remainLine=NULL; ! wxShape *upshape=NULL; ! int m = 99999; ! while (node) ! { ! wxLineShape *line = (wxLineShape *) node->GetData (); ! if (line->GetFrom() == cshape) ! { ! remainLine=line; ! } ! else ! { ! if (line->GetAttachmentTo() < m) ! { ! upshape = line->GetFrom(); ! m = line->GetAttachmentTo(); ! } ! line->Select (false); ! GetActiveDiagram()->RemoveShape (line); ! line->Unlink (); ! } ! node = node->GetNext (); ! } ! remainLine->SetFrom(upshape); ! MISOShape::NormalizeLine(remainLine); ! } ! else ! { ! RemoveLines (shape); ! } ! GetActiveDiagram()->RemoveShape (shape); ! shape->Unlink (); ! shape->GetCanvas ()->Refresh (); } } |
From: Matthew G. <mat...@us...> - 2007-03-04 03:12:58
|
Update of /cvsroot/jsbsimcommander/src/gui In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv31330/src/gui Modified Files: shape.cpp shape.h Log Message: Replace 'first' with 'head', replace 'last' with 'tail' to correct its meaning in member function 'MyEvtHandler::OnEndDragLeft' Index: shape.cpp =================================================================== RCS file: /cvsroot/jsbsimcommander/src/gui/shape.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shape.cpp 4 Mar 2007 03:03:31 -0000 1.14 --- shape.cpp 4 Mar 2007 03:12:54 -0000 1.15 *************** *** 263,276 **** } ! void MyEvtHandler::FindOneSegment(wxNode* &first, unsigned int &j, wxNode* last) { // shift the dup control points wxRealPoint* p1; ! wxRealPoint* p2 = (wxRealPoint*)last->GetData(); ! while (first && (p1 = (wxRealPoint*)first->GetData()) && fabs(p1->x - p2->x) < 1e-4 && fabs(p1->y - p2->y) < 1e-4 ) { ! first = first->GetNext(); ++j; } --- 263,276 ---- } ! void MyEvtHandler::FindOneSegment(wxNode* &head, unsigned int &j, wxNode* tail) { // shift the dup control points wxRealPoint* p1; ! wxRealPoint* p2 = (wxRealPoint*)tail->GetData(); ! while (head && (p1 = (wxRealPoint*)head->GetData()) && fabs(p1->x - p2->x) < 1e-4 && fabs(p1->y - p2->y) < 1e-4 ) { ! head = head->GetNext(); ++j; } *************** *** 278,289 **** // shift the lines in the same slope double dx,dy; ! if (first) { dy = p1->y - p2->y; dx = p1->x - p2->x; ! wxNode * prio = first->GetNext(); while (prio) { ! p1 = (wxRealPoint*)first->GetData(); p2 = (wxRealPoint*)prio->GetData(); double ddx, ddy; --- 278,289 ---- // shift the lines in the same slope double dx,dy; ! if (head) { dy = p1->y - p2->y; dx = p1->x - p2->x; ! wxNode * prio = head->GetNext(); while (prio) { ! p1 = (wxRealPoint*)head->GetData(); p2 = (wxRealPoint*)prio->GetData(); double ddx, ddy; *************** *** 295,299 **** || fabs(dy / dx - ddy/ddx) < 1e-4) { ! first = prio; ++j; prio = prio->GetNext(); --- 295,299 ---- || fabs(dy / dx - ddy/ddx) < 1e-4) { ! head = prio; ++j; prio = prio->GetNext(); *************** *** 338,353 **** wxList * cp = current->GetLineControlPoints(); // find first segment line ! wxNode * last = cp->GetFirst(); unsigned int i=0; // one step ! wxNode *first = last->GetNext(); unsigned int j=1; ! FindOneSegment(first, j, last); ! while (first) { ! wxRealPoint* p1 = (wxRealPoint*)first->GetData(); ! wxRealPoint* p2 = (wxRealPoint*)last->GetData(); double l = p1->x < p2->x ? p1->x : p2->x ; double r = p1->x > p2->x ? p1->x : p2->x ; --- 338,353 ---- wxList * cp = current->GetLineControlPoints(); // find first segment line ! wxNode * tail = cp->GetFirst(); unsigned int i=0; // one step ! wxNode *head = tail->GetNext(); unsigned int j=1; ! FindOneSegment(head, j, tail); ! while (head) { ! wxRealPoint* p1 = (wxRealPoint*)head->GetData(); ! wxRealPoint* p2 = (wxRealPoint*)tail->GetData(); double l = p1->x < p2->x ? p1->x : p2->x ; double r = p1->x > p2->x ? p1->x : p2->x ; *************** *** 362,371 **** break; } ! last = first; i = j; ! first = first->GetNext(); ++j; ! FindOneSegment(first, j, last); } if (flag) --- 362,371 ---- break; } ! tail = head; i = j; ! head = head->GetNext(); ++j; ! FindOneSegment(head, j, tail); } if (flag) *************** *** 410,419 **** diagram->AddShape (theShape); from->AddLine ((wxLineShape *) theShape, cshape, attachFrom, 1); ! first = cp->GetFirst(); for (int k=0; k<i+2; ++k) { *((wxRealPoint *) lineShape->GetLineControlPoints ()->Item (k)-> ! GetData ()) = *((wxRealPoint *) first->GetData()); ! first = first->GetNext(); } cshape->GetAttachmentPosition(1, &(((wxRealPoint *) lineShape->GetLineControlPoints ()->GetLast()-> GetData ())->x), &(((wxRealPoint *) lineShape->GetLineControlPoints ()->GetLast()-> GetData ())->y)); --- 410,419 ---- diagram->AddShape (theShape); from->AddLine ((wxLineShape *) theShape, cshape, attachFrom, 1); ! head = cp->GetFirst(); for (int k=0; k<i+2; ++k) { *((wxRealPoint *) lineShape->GetLineControlPoints ()->Item (k)-> ! GetData ()) = *((wxRealPoint *) head->GetData()); ! head = head->GetNext(); } cshape->GetAttachmentPosition(1, &(((wxRealPoint *) lineShape->GetLineControlPoints ()->GetLast()-> GetData ())->x), &(((wxRealPoint *) lineShape->GetLineControlPoints ()->GetLast()-> GetData ())->y)); *************** *** 424,433 **** wxRealPoint* startp = (wxRealPoint*)cp->Item(j-1)->GetData(); cshape->GetAttachmentPosition (0, &(startp->x), &(startp->y)); ! first = cp->GetFirst(); ! while(first != start) { ! last = first; ! first = first->GetNext(); ! cp->DeleteNode(last); } current->Straighten(); --- 424,433 ---- wxRealPoint* startp = (wxRealPoint*)cp->Item(j-1)->GetData(); cshape->GetAttachmentPosition (0, &(startp->x), &(startp->y)); ! head = cp->GetFirst(); ! while(head != start) { ! tail = head; ! head = head->GetNext(); ! cp->DeleteNode(tail); } current->Straighten(); Index: shape.h =================================================================== RCS file: /cvsroot/jsbsimcommander/src/gui/shape.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shape.h 4 Mar 2007 03:03:31 -0000 1.9 --- shape.h 4 Mar 2007 03:12:54 -0000 1.10 *************** *** 53,58 **** protected: ! /// find one look-like Segment Line from a line list start from last. ! void FindOneSegment(wxNode* &first, unsigned int &j, wxNode* last); }; --- 53,58 ---- protected: ! /// find one look-like Segment Line from a line list start from tail. ! void FindOneSegment(wxNode* &head, unsigned int &j, wxNode* tail); }; |
From: Matthew G. <mat...@us...> - 2007-03-04 03:03:35
|
Update of /cvsroot/jsbsimcommander/src/gui In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv26867/src/gui Modified Files: shape.cpp shape.h Log Message: Fix the bug when we insert a component into two. Index: shape.cpp =================================================================== RCS file: /cvsroot/jsbsimcommander/src/gui/shape.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** shape.cpp 3 Mar 2007 13:08:12 -0000 1.13 --- shape.cpp 4 Mar 2007 03:03:31 -0000 1.14 *************** *** 263,266 **** --- 263,310 ---- } + void MyEvtHandler::FindOneSegment(wxNode* &first, unsigned int &j, wxNode* last) + { + // shift the dup control points + wxRealPoint* p1; + wxRealPoint* p2 = (wxRealPoint*)last->GetData(); + while (first && (p1 = (wxRealPoint*)first->GetData()) + && fabs(p1->x - p2->x) < 1e-4 + && fabs(p1->y - p2->y) < 1e-4 ) + { + first = first->GetNext(); + ++j; + } + + // shift the lines in the same slope + double dx,dy; + if (first) + { + dy = p1->y - p2->y; + dx = p1->x - p2->x; + wxNode * prio = first->GetNext(); + while (prio) + { + p1 = (wxRealPoint*)first->GetData(); + p2 = (wxRealPoint*)prio->GetData(); + double ddx, ddy; + ddy = p1->y - p2->y; + ddx = p1->x - p2->x; + + if ( fabs(ddx) < 1e-4 && fabs(ddy) < 1e-4 + || fabs(ddx) < 1e-4 && fabs(dx) < 1e-4 && dy*ddy>0 + || fabs(dy / dx - ddy/ddx) < 1e-4) + { + first = prio; + ++j; + prio = prio->GetNext(); + } + else + { + break; + } + } + } + } + void MyEvtHandler::OnEndDragLeft(double x, double y, int keys, int attachment) { *************** *** 293,300 **** bool flag = false; wxList * cp = current->GetLineControlPoints(); ! wxNode * first = cp->GetFirst(); ! wxNode * last = first; ! first = first->GetNext(); unsigned int i=0; while (first) { --- 337,349 ---- bool flag = false; wxList * cp = current->GetLineControlPoints(); ! // find first segment line ! wxNode * last = cp->GetFirst(); unsigned int i=0; + // one step + wxNode *first = last->GetNext(); + unsigned int j=1; + + FindOneSegment(first, j, last); + while (first) { *************** *** 314,323 **** } last = first; first = first->GetNext(); ! ++i; } if (flag) { ! //TODO now we can insert the ComponentShape into the two MISOShape. { std::cout << "MyEvtHandler::OnEndDragLeft for ComponentShape without lines and find the line" << std::endl; --- 363,376 ---- } last = first; + i = j; first = first->GetNext(); ! ++j; ! ! FindOneSegment(first, j, last); } if (flag) { ! //Now we can insert the ComponentShape into the two MISOShape. ! /************************************************************* { std::cout << "MyEvtHandler::OnEndDragLeft for ComponentShape without lines and find the line" << std::endl; *************** *** 333,336 **** --- 386,390 ---- } } + ***************************************************************/ wxShape *from = current->GetFrom(); wxShape *to = current->GetTo(); *************** *** 357,363 **** from->AddLine ((wxLineShape *) theShape, cshape, attachFrom, 1); first = cp->GetFirst(); ! for (int j=0; j<i+2; ++j) { ! *((wxRealPoint *) lineShape->GetLineControlPoints ()->Item (j)-> GetData ()) = *((wxRealPoint *) first->GetData()); first = first->GetNext(); --- 411,417 ---- from->AddLine ((wxLineShape *) theShape, cshape, attachFrom, 1); first = cp->GetFirst(); ! for (int k=0; k<i+2; ++k) { ! *((wxRealPoint *) lineShape->GetLineControlPoints ()->Item (k)-> GetData ()) = *((wxRealPoint *) first->GetData()); first = first->GetNext(); *************** *** 368,372 **** theShape->Show (true); ! wxRealPoint* startp = (wxRealPoint*)cp->Item(i)->GetData(); cshape->GetAttachmentPosition (0, &(startp->x), &(startp->y)); first = cp->GetFirst(); --- 422,426 ---- theShape->Show (true); ! wxRealPoint* startp = (wxRealPoint*)cp->Item(j-1)->GetData(); cshape->GetAttachmentPosition (0, &(startp->x), &(startp->y)); first = cp->GetFirst(); *************** *** 378,381 **** --- 432,436 ---- } current->Straighten(); + MISOShape::NormalizeLine(current); { Index: shape.h =================================================================== RCS file: /cvsroot/jsbsimcommander/src/gui/shape.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** shape.h 3 Mar 2007 13:08:12 -0000 1.8 --- shape.h 4 Mar 2007 03:03:31 -0000 1.9 *************** *** 51,54 **** --- 51,58 ---- void OnEndDragRight(double x, double y, int keys = 0, int attachment = 0); void OnEndDragLeft(double x, double y, int keys=0, int attachment = 0); + + protected: + /// find one look-like Segment Line from a line list start from last. + void FindOneSegment(wxNode* &first, unsigned int &j, wxNode* last); }; |
From: Matthew G. <mat...@us...> - 2007-03-03 13:08:16
|
Update of /cvsroot/jsbsimcommander/src/gui In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv22204/src/gui Modified Files: shape.cpp shape.h Log Message: Now we can insert a single shape into tow connected shapes. Correct the function ComponentShape::GetOutputName. Index: shape.cpp =================================================================== RCS file: /cvsroot/jsbsimcommander/src/gui/shape.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** shape.cpp 2 Mar 2007 03:26:59 -0000 1.12 --- shape.cpp 3 Mar 2007 13:08:12 -0000 1.13 *************** *** 296,300 **** wxNode * last = first; first = first->GetNext(); ! unsigned int i=1; while (first) { --- 296,300 ---- wxNode * last = first; first = first->GetNext(); ! unsigned int i=0; while (first) { *************** *** 320,334 **** { //TODO now we can insert the ComponentShape into the two MISOShape. - std::cout << "MyEvtHandler::OnEndDragLeft for ComponentShape without lines and find the line" << std::endl; - MISOShape * from = wxDynamicCast(current->GetFrom(), MISOShape); - if (from) { ! std::cout << "From:" << from->GetName() << ", Type:" << from->GetType() << endl; } ! MISOShape * to = wxDynamicCast(current->GetTo(), MISOShape); ! if (to) { ! std::cout << "To:" << to->GetName() << ", Type:" << to->GetType() << endl; } break; } --- 320,409 ---- { //TODO now we can insert the ComponentShape into the two MISOShape. { ! std::cout << "MyEvtHandler::OnEndDragLeft for ComponentShape without lines and find the line" << std::endl; ! MISOShape * from = wxDynamicCast(current->GetFrom(), MISOShape); ! if (from) ! { ! std::cout << "From:" << from->GetName() << ", Type:" << from->GetType() << endl; ! } ! MISOShape * to = wxDynamicCast(current->GetTo(), MISOShape); ! if (to) ! { ! std::cout << "To:" << to->GetName() << ", Type:" << to->GetType() << endl; ! } } ! wxShape *from = current->GetFrom(); ! wxShape *to = current->GetTo(); ! int attachFrom = current->GetAttachmentFrom(); ! int attachTo = current->GetAttachmentTo(); ! from->RemoveLine(current); ! cshape->AddLine(current, to, 0, attachTo); ! ! wxNode * start = cp->Item(i); ! ! wxLineShape * theShape; ! theShape = new wxLineShape; ! theShape->AssignNewIds (); ! theShape->SetEventHandler(new MyEvtHandler(theShape, theShape)); ! theShape->SetPen (wxBLACK_PEN); ! theShape->SetBrush (wxRED_BRUSH); ! wxLineShape *lineShape = theShape; ! // Yes, you can have more than 2 control points, in which case ! // it becomes a multi-segment line. ! lineShape->MakeLineControlPoints (i+2); ! lineShape->AddArrow (ARROW_ARROW, ARROW_POSITION_END, 10.0, 0.0, ! _T ("Normal arrowhead")); ! diagram->AddShape (theShape); ! from->AddLine ((wxLineShape *) theShape, cshape, attachFrom, 1); ! first = cp->GetFirst(); ! for (int j=0; j<i+2; ++j) { ! *((wxRealPoint *) lineShape->GetLineControlPoints ()->Item (j)-> ! GetData ()) = *((wxRealPoint *) first->GetData()); ! first = first->GetNext(); } + cshape->GetAttachmentPosition(1, &(((wxRealPoint *) lineShape->GetLineControlPoints ()->GetLast()-> GetData ())->x), &(((wxRealPoint *) lineShape->GetLineControlPoints ()->GetLast()-> GetData ())->y)); + lineShape->Straighten(); + MISOShape::NormalizeLine(lineShape); + theShape->Show (true); + + wxRealPoint* startp = (wxRealPoint*)cp->Item(i)->GetData(); + cshape->GetAttachmentPosition (0, &(startp->x), &(startp->y)); + first = cp->GetFirst(); + while(first != start) + { + last = first; + first = first->GetNext(); + cp->DeleteNode(last); + } + current->Straighten(); + + { + ComponentShape * cfrom = wxDynamicCast(from, ComponentShape); + ComponentShape * cto = wxDynamicCast(to, ComponentShape); + if (cfrom) + { + long int f = cfrom->GetOrder(); + if (cto) + { + long int t = cto->GetOrder(); + cshape->SetOrder((t+f)/2, false); + } + else + { + cshape->SetOrder(f+10, false); + } + } + else + { + if (cto) + { + long int t = cto->GetOrder(); + cshape->SetOrder(t-10, false); + } + } + } + canvas->Refresh(); + canvas->Update(); break; } *************** *** 1098,1109 **** void ! ComponentShape::SetOrder(long int & o) { if ( order == o ) return; ! wxDiagram *diagram = GetCanvas()->GetDiagram (); ! wxObjectList::compatibility_iterator node = diagram->GetShapeList ()->GetFirst (); ! while (node) { wxShape *eachShape = (wxShape *) node->GetData (); --- 1173,1186 ---- void ! ComponentShape::SetOrder(const long int & o, bool exchange) { if ( order == o ) return; ! if (exchange) ! { ! wxDiagram *diagram = GetCanvas()->GetDiagram (); ! wxObjectList::compatibility_iterator node = diagram->GetShapeList ()->GetFirst (); ! while (node) { wxShape *eachShape = (wxShape *) node->GetData (); *************** *** 1119,1123 **** --- 1196,1202 ---- } node = node->GetNext (); + } + } order = o; } *************** *** 1320,1324 **** ComponentShape::GetOutputName() const { ! wxString rslt = wxT("NULL"); wxNode * node = GetLines().GetFirst(); while (node) --- 1399,1403 ---- ComponentShape::GetOutputName() const { ! wxString rslt = _("NULL"); wxNode * node = GetLines().GetFirst(); while (node) *************** *** 1342,1345 **** --- 1421,1432 ---- rslt = result->GetName(); } + else if (shape->IsKindOf(CLASSINFO(MISOShape))) + { + rslt = mkName(wxDynamicCast(shape, MISOShape)->GetName(), true); + } + else if (shape->IsKindOf(CLASSINFO(SIMOShape))) + { + rslt = _("Multiple Outputs"); + } break; //only one output } Index: shape.h =================================================================== RCS file: /cvsroot/jsbsimcommander/src/gui/shape.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** shape.h 2 Mar 2007 03:26:59 -0000 1.7 --- shape.h 3 Mar 2007 13:08:12 -0000 1.8 *************** *** 91,95 **** //called after addline or move to adjust the line(s) to the shape ! void NormalizeLine (wxLineShape * line); void NormalizeLines (); --- 91,95 ---- //called after addline or move to adjust the line(s) to the shape ! static void NormalizeLine (wxLineShape * line); void NormalizeLines (); *************** *** 308,312 **** //check and set void SetOrder(); ! void SetOrder(long int & o); }; --- 308,312 ---- //check and set void SetOrder(); ! void SetOrder(const long int & o, bool exchange= true); }; |
From: Matthew G. <mat...@us...> - 2007-03-02 03:27:22
|
Update of /cvsroot/jsbsimcommander/src/gui In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv23121/src/gui Modified Files: shape.cpp shape.h Log Message: Initial work to insert a single shape into tow connected shapes. Index: shape.cpp =================================================================== RCS file: /cvsroot/jsbsimcommander/src/gui/shape.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** shape.cpp 14 Jul 2006 01:42:08 -0000 1.11 --- shape.cpp 2 Mar 2007 03:26:59 -0000 1.12 *************** *** 263,266 **** --- 263,341 ---- } + void MyEvtHandler::OnEndDragLeft(double x, double y, int keys, int attachment) + { + wxShapeEvtHandler::OnEndDragLeft(x, y, keys, attachment); + + ComponentShape * cshape = wxDynamicCast( GetShape(), ComponentShape); + if (cshape) + { + if (cshape->GetLines().IsEmpty()) + { + double width = 0.0, height = 0.0; + cshape->GetBoundingBoxMin(&width, &height); + if (width < 4.0) width = 4.0; + if (height < 4.0) height = 4.0; + + double left = (double)(cshape->GetX() - (width/2.0)); + double top = (double)(cshape->GetY() - (height/2.0)); + double right = (double)(cshape->GetX() + (width/2.0)); + double bottom = (double)(cshape->GetY() + (height/2.0)); + + MyCanvas *canvas = (MyCanvas *) GetShape()->GetCanvas (); + wxDiagram * diagram = canvas->GetDiagram(); + wxList * shapes = diagram->GetShapeList(); + // let's iterate over the list + for ( wxNode *node = shapes->GetFirst(); node; node = node->GetNext() ) + { + wxLineShape *current = wxDynamicCast(node->GetData(), wxLineShape); + if (current) + { + bool flag = false; + wxList * cp = current->GetLineControlPoints(); + wxNode * first = cp->GetFirst(); + wxNode * last = first; + first = first->GetNext(); + unsigned int i=1; + while (first) + { + wxRealPoint* p1 = (wxRealPoint*)first->GetData(); + wxRealPoint* p2 = (wxRealPoint*)last->GetData(); + double l = p1->x < p2->x ? p1->x : p2->x ; + double r = p1->x > p2->x ? p1->x : p2->x ; + double t = p1->y < p2->y ? p1->y : p2->y ; + double b = p1->y > p2->y ? p1->y : p2->y ; + // Check whether the line is cross the shape. + // TODO too simple method to check. + if (l < left && r > right && t >= top && b <= bottom + || l >= left && r <= right && t < top && b > bottom) + { + flag = true; + break; + } + last = first; + first = first->GetNext(); + ++i; + } + if (flag) + { + //TODO now we can insert the ComponentShape into the two MISOShape. + std::cout << "MyEvtHandler::OnEndDragLeft for ComponentShape without lines and find the line" << std::endl; + MISOShape * from = wxDynamicCast(current->GetFrom(), MISOShape); + if (from) + { + std::cout << "From:" << from->GetName() << ", Type:" << from->GetType() << endl; + } + MISOShape * to = wxDynamicCast(current->GetTo(), MISOShape); + if (to) + { + std::cout << "To:" << to->GetName() << ", Type:" << to->GetType() << endl; + } + break; + } + } + } + } + } + } /* Index: shape.h =================================================================== RCS file: /cvsroot/jsbsimcommander/src/gui/shape.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** shape.h 14 Jul 2006 01:42:08 -0000 1.6 --- shape.h 2 Mar 2007 03:26:59 -0000 1.7 *************** *** 50,53 **** --- 50,54 ---- void OnDragRight(bool draw, double x, double y, int keys = 0, int attachment = 0); void OnEndDragRight(double x, double y, int keys = 0, int attachment = 0); + void OnEndDragLeft(double x, double y, int keys=0, int attachment = 0); }; |
From: Jon S. B. <jb...@us...> - 2007-02-28 04:48:49
|
Update of /cvsroot/jsbsimcommander/src/gui In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv26457/src/gui Modified Files: sensor.cpp sensor_dlg.cpp Log Message: Small changes to sensor classes Index: sensor.cpp =================================================================== RCS file: /cvsroot/jsbsimcommander/src/gui/sensor.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** sensor.cpp 25 Feb 2007 22:12:42 -0000 1.10 --- sensor.cpp 28 Feb 2007 04:48:44 -0000 1.11 *************** *** 183,193 **** if (noise_variance != 0.0) { if (NoiseType == 0) { ! stream << Pre << wxT("<noise variation=\"PERCENT\"> ") << noise_variance << wxT(" </noise>") << endl; } else { ! stream << Pre << wxT("<noise variation=\"ABSOLUTE\"> ") << noise_variance << wxT(" </noise>") << endl; } } ! if (!quant_property.empty() || bits != 0) { } --- 183,204 ---- if (noise_variance != 0.0) { if (NoiseType == 0) { ! stream << Pre << wxT(" <noise variation=\"PERCENT\"> ") << noise_variance << wxT(" </noise>") << endl; } else { ! stream << Pre << wxT(" <noise variation=\"ABSOLUTE\"> ") << noise_variance << wxT(" </noise>") << endl; } } ! if (bits != 0) { ! if (!quant_property.empty()) { ! stream << Pre << wxT("<quantization name=\"") << quant_property << wxT("\">") << endl; ! } else { ! stream << Pre << wxT("<quantization>") << endl; ! } ! stream << Pre << wxT(" <bits>") << bits << "</bits>" << endl; ! stream << Pre << wxT(" <min>") << min << "</min>" << endl; ! stream << Pre << wxT(" <max>") << min << "</max>" << endl; ! if (!quant_property.empty()) { ! stream << Pre << wxT("</quantization>") << endl; ! } } Index: sensor_dlg.cpp =================================================================== RCS file: /cvsroot/jsbsimcommander/src/gui/sensor_dlg.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sensor_dlg.cpp 18 Feb 2007 16:54:25 -0000 1.1 --- sensor_dlg.cpp 28 Feb 2007 04:48:44 -0000 1.2 *************** *** 375,378 **** --- 375,379 ---- *text_ctrl_output_prop << g->GetOutputName(); + if (inputs.GetCount() > 0) { if (inputs[0] != wxT("NULL")) |