Esempio n. 1
0
//------------------------------------------------------------------------------
// void OnColorPickerChange(wxColourPickerEvent& event)
//------------------------------------------------------------------------------
void GmatColorPanel::OnColorPickerChange(wxColourPickerEvent& event)
{
   #ifdef DEBUG_COLOR_CHANGE
   MessageInterface::ShowMessage("GmatColorPanel::OnColorPickerChange() entered\n");
   #endif
   
   if (event.GetEventObject() == mOrbitColorCtrl)
   {
      wxColour wxcolor = mOrbitColorCtrl->GetColour();
      RgbColor rgbColor = RgbColor(wxcolor.Red(), wxcolor.Green(), wxcolor.Blue());
      if (mUseInputObjectColor)
      {
         mOrbitIntColor = rgbColor.GetIntColor();
      }
      else
      {
         std::string colorStr = RgbColor::ToRgbString(rgbColor.GetIntColor());
         theClonedSpacePoint->
            SetStringParameter(theClonedSpacePoint->GetParameterID("OrbitColor"), colorStr);
      }
   }
   else if (event.GetEventObject() == mTargetColorCtrl)
   {
      wxColour wxcolor = mTargetColorCtrl->GetColour();
      RgbColor rgbColor = RgbColor(wxcolor.Red(), wxcolor.Green(), wxcolor.Blue());
      if (mUseInputObjectColor)
      {
         mTargetIntColor = rgbColor.GetIntColor();
      }
      else
      {
         std::string colorStr = RgbColor::ToRgbString(rgbColor.GetIntColor());
         theClonedSpacePoint->
            SetStringParameter(theClonedSpacePoint->GetParameterID("TargetColor"), colorStr);
      }
   }
   
	mHasColorChanged = true;
	theParentGmatPanel->EnableUpdate(true);
   
   #ifdef DEBUG_COLOR_CHANGE
   MessageInterface::ShowMessage("GmatColorPanel::OnColorPickerChange() leaving\n");
   #endif
}
Esempio n. 2
0
//------------------------------------------------------------------------------
// void ShowSpacePointColor(const wxString &name, UnsignedInt color = GmatColor::RED)
//------------------------------------------------------------------------------
void GroundTrackPlotPanel::ShowSpacePointColor(const wxString &name, UnsignedInt color)
{
   #ifdef DEBUG_PANEL_COLOR
   MessageInterface::ShowMessage
      ("OrbitViewPanel::ShowSpacePointColor() name='%s'\n", name.c_str());
   #endif
   
   if (!name.IsSameAs(""))
   {
      std::string selObjName = name.c_str();
      
      // if object name not found, insert
      if (mOrbitColorMap.find(selObjName) == mOrbitColorMap.end())
      {
         #ifdef DEBUG_PANEL_COLOR
         MessageInterface::ShowMessage
            ("ShowSpacePointColor() name not found, so adding it to color map\n");
         #endif
         
         mOrbitColorMap[selObjName] = RgbColor(color);
         mTargetColorMap[selObjName] = RgbColor(GmatColor::ORANGE);
      }
      
      RgbColor orbColor = mOrbitColorMap[selObjName];
      RgbColor targColor = mTargetColorMap[selObjName];
      
      #ifdef DEBUG_PANEL_COLOR
      MessageInterface::ShowMessage
         ("OrbitViewPanel::ShowSpacePointColor() orbColor=%u, targColor=%u\n",
          orbColor.GetIntColor(), targColor.GetIntColor());
      #endif
      
      mOrbitColor.Set(orbColor.Red(), orbColor.Green(), orbColor.Blue());      
      mTargetColor.Set(targColor.Red(), targColor.Green(), targColor.Blue());
      
      mOrbitColorCtrl->SetColour(mOrbitColor);
      mTargetColorCtrl->SetColour(mTargetColor);
   }
}
Esempio n. 3
0
//--------------------------------------------------------------------
void Structure::WriteSummary (std::ostream& s, const Integer level) const
// Write a breigf summary of the object
   {
   std::string indent = std::string (level*2,' ');
   RgbColor c = Color;
   s << indent << "Structure " + Name+ ", Color = (" << 
      RgbColor::ToRgbString (c.GetIntColor()) << ")" << std::endl;
   s << indent << "Appendage count = " << 
      GmatStringUtil::ToString (Appendages.Size(),true,4) << std::endl;
   for (Integer ix=0;  ix<=Appendages.Size()-1;  ++ix)
      Appendages[ix]->WriteSummary (s,level+1);
   s << indent << "Material count = " << 
      GmatStringUtil::ToString (Materials.Size(),true,4) << std::endl;
   for (Integer im=0;  im<=Materials.Size()-1;  ++im)
      Materials[im]->WriteSummary (s,level+1);
   s << indent << "End Structure" << std::endl;
   }
Esempio n. 4
0
//------------------------------------------------------------------------------
// void OnCheckBoxChange(wxCommandEvent& event)
//------------------------------------------------------------------------------
void GmatColorPanel::OnCheckBoxChange(wxCommandEvent& event)
{
   mHasOverrideColorChanged = true;
   mOverrideOrbitColor = mOverrideOrbitColorCheckBox->GetValue();
   
   if (mOverrideOrbitColor)
   {
      mOrbitColorLabel->Enable(true);
      mOrbitColorCtrl->Enable(true);      
   }
   else
   {
      // Show original orbit color
      RgbColor rgbOrbitColor = RgbColor(mDefaultOrbitColor);
      mOrbitColor.Set(rgbOrbitColor.Red(), rgbOrbitColor.Green(), rgbOrbitColor.Blue());      
      mOrbitColorCtrl->SetColour(mOrbitColor);
      mOrbitIntColor = rgbOrbitColor.GetIntColor();
      mOrbitColorLabel->Enable(false);
      mOrbitColorCtrl->Enable(false);
   }
   
	theParentGmatPanel->EnableUpdate(true);
}
Esempio n. 5
0
//------------------------------------------------------------------------------
// void LoadData()
//------------------------------------------------------------------------------
void GmatColorPanel::LoadData()
{
   #ifdef DEBUG_PANEL_LOAD
   MessageInterface::ShowMessage("GmatColorPanel::LoadData() entered.\n");
   #endif

   try
   {
      if (mUseInputObjectColor)
      {
         // Load colors from the input object name
         SpacePoint *sp = (SpacePoint*)
            ((theParentGmatPanel->GetGuiInterpreter())->GetConfiguredObject(mSpacePointName));
         if (sp)
         {
            mOrbitIntColor = sp->GetCurrentOrbitColor();
            mTargetIntColor = sp->GetCurrentTargetColor();
         }
      }
      else
      {
         // Load colors from the spacecraft
         mOrbitIntColor = theClonedSpacePoint->GetCurrentOrbitColor();
         mTargetIntColor = theClonedSpacePoint->GetCurrentTargetColor();
      }
      
      mDefaultOrbitColor = mOrbitIntColor;
      if (mOverrideOrbitColor)
         mOrbitIntColor = mOverrdingColor;
      
      RgbColor rgbOrbitColor = RgbColor(mOrbitIntColor);
      RgbColor rgbTargetColor = RgbColor(mTargetIntColor);
      
      #ifdef DEBUG_PANEL_LOAD
      MessageInterface::ShowMessage("   rgbOrbitColor  = %06X\n", rgbOrbitColor.GetIntColor());
      MessageInterface::ShowMessage("   rgbTargetColor = %06X\n", rgbTargetColor.GetIntColor());
      #endif
      
      mOrbitColor.Set(rgbOrbitColor.Red(), rgbOrbitColor.Green(), rgbOrbitColor.Blue());      
      mOrbitColorCtrl->SetColour(mOrbitColor);
      mTargetColor.Set(rgbTargetColor.Red(), rgbTargetColor.Green(), rgbTargetColor.Blue());
      mTargetColorCtrl->SetColour(mTargetColor);
      
      // If showing only orbit color, hide target color
      if (mShowOrbitColorOnly)
      {
         mTargetColorLabel->Hide();
         mTargetColorCtrl->Hide();
      }
      
      // Set value to overrding color CheckBox
      if (mOverrideOrbitColor)
         mOverrideOrbitColorCheckBox->SetValue(true);
      else
         mOverrideOrbitColorCheckBox->SetValue(false);
      
      // If not showing override color check box, hide it
      if (!mShowOverrideOrbitColorCheckBox)
         mOverrideOrbitColorCheckBox->Hide();
      else
      {
         // If not overriding orbit color, disable it
         if (!mOverrideOrbitColor)
         {
            mOrbitColorLabel->Disable();
            mOrbitColorCtrl->Disable();
         }
      }
      Layout();
   }
   catch (BaseException &e)
   {
      MessageInterface::PopupMessage(Gmat::ERROR_, e.GetFullMessage().c_str());
   }
   
   #ifdef DEBUG_PANEL_LOAD
   MessageInterface::ShowMessage("GmatColorPanel::LoadData() leaving\n");
   #endif
}
Esempio n. 6
0
//------------------------------------------------------------------------------
UnsignedInt RgbColor::ToIntColor(const std::string &colorString)
{
   #ifdef DEBUG_INT_COLOR
   MessageInterface::ShowMessage
      ("RgbColor::ToIntColor() entered, colorString = '%s'\n", colorString.c_str());
   #endif
   
   // First figure out if input is a color name
   ColorDatabase *colorDb = ColorDatabase::Instance();
   UnsignedInt intColor;
   
   if (!GmatStringUtil::StartsWith(colorString, "[") &&
       !GmatStringUtil::EndsWith(colorString, "]"))
   {
      if (colorDb->HasColor(colorString))
      {
         intColor = colorDb->GetIntColor(colorString);
         #ifdef DEBUG_INT_COLOR
         MessageInterface::ShowMessage("RgbColor::ToIntColor() returning %06X\n", intColor);
         #endif
         return intColor;
      }
      else
      {
         UtilityException ue;
         ue.SetDetails("The color \"%s\" not found in the color database. "
                       "Available colors are \"%s\"", colorString.c_str(),
                       colorDb->GetAllColorNames().c_str());
         throw ue;
      }
   }
   
   // It is rgb tuples
   UnsignedIntArray intArray = GmatStringUtil::ToUnsignedIntArray(colorString);
   Byte rgb[3];
   bool error = false;
   if (intArray.size() != 3)
   {
      error = true;
   }
   else
   {
      for (UnsignedInt i = 0; i < intArray.size(); i++)
      {
         if (intArray[i] < 0 || intArray[i] > 255)
         {
            error = true;
            break;
         }
         else
         {
            rgb[i] = intArray[i];
         }
      }
   }
   
   if (error)
   {
      UtilityException ue;
      ue.SetDetails("\"%s\" has invalid RGB color values. Valid color value is "
                    "triplet Integer number between 0 and 255 inside of [ ]",
                    colorString.c_str());
      throw ue;
   }
   else
   {
      RgbColor color = RgbColor(rgb[0], rgb[1], rgb[2]);
      intColor = color.GetIntColor();
      #ifdef DEBUG_INT_COLOR
      MessageInterface::ShowMessage("RgbColor::ToIntColor() returning %06X\n", intColor);
      #endif
      return intColor;
   }
}