getPlotType() public method

public getPlotType ( ) : IntegerElement,
return IntegerElement,
コード例 #1
0
ファイル: PrettyPrintVisitor.cs プロジェクト: shranjan/pinac
    /// <summary>
    /// -- Plotting functions.
    /// </summary>
    /// <param name="element"></param>

  public override void VisitPlotFunctionElement(PlotFunctionElement element)
  {
      {
        

          if (element.getPlotFunction() == "subPlot")
          {
              if (element.getPlotType().getText() == "1")
              {
                  Console.WriteLine("subPlot of type 1D :");
                  Console.Write("subPlot1D(");
                  VisitElement(element.getRow()); Console.Write(",");
                  VisitElement(element.getColumn()); Console.Write(",");
                  VisitElement(element.getData()); Console.Write(",");
                  VisitElement(element.getTitle()); Console.Write(");\n");



              }
              else if (element.getPlotType().getText() == "2")
              {
                  //-- call the 2d subplot function.
                 
                  Console.WriteLine("subPlot of type 2D :");
                  Console.Write("subPlot2D(");
                  VisitElement(element.getRow()); Console.Write(",");
                  VisitElement(element.getColumn()); Console.Write(",");
                  VisitElement(element.getData()); Console.Write(",");
                  VisitElement(element.getTitle()); Console.Write(");\n");
              }
              else if (element.getPlotType().getText() == "3")
              {
                  //-- call the 3d subplot function.
                  ///-- MODE: TBD
                  ///-- CHANGE: MODE TO A DEFAULT VALUE:

                  Console.WriteLine("subPlot of type 3D :");
                  Console.Write("subPlot3D(");
                  VisitElement(element.getRow()); Console.Write(",");
                  VisitElement(element.getColumn()); Console.Write(",");
                  VisitElement(element.getData()); Console.Write(",");
                  VisitElement(element.getMode()); Console.Write(",");
                  VisitElement(element.getTitle()); Console.Write(");\n");
              }
          }
          else if (element.getPlotFunction() == "plot")
          {
              //-- same implementation as above can be used.
              Console.WriteLine("\nvisited plot fuction \n");
              
          }
          else if (element.getPlotFunction() == "resetPlot")
          {
              
              Console.WriteLine("\n visited resetPlot() \n");
          }
          else if (element.getPlotFunction() == "setPlotAxis")
          {
              ///-- will change from int to double....
              Console.WriteLine("\n visited setPlotAxis \n");
          }
          else if (element.getPlotFunction() == "setPlotAxisTitle")
          {
              Console.WriteLine("\n visited setPlotAxisTitle\n");
          }
          else if (element.getPlotFunction() == "setScaleMode")
          {
              Console.WriteLine("\n visited setScaleMode \n");
          }

      }


  }
コード例 #2
0
ファイル: InterpreterVisitor_.cs プロジェクト: rkpandya/pinac
 private Plot convert_Ele_to_plot(PlotFunctionElement p)
 {
     Plot p1 = new Plot();
     p1.Command = p.getPlotFunction();
     p1.PaneNum = p.getPeno() == null ? 0 : int.Parse(p.getPeno().getText());
     if (mVariableMap.ContainsKey(p.getData().getText()))
     {
         double[,] temp = ((MatrixVariableDeclaration)(mVariableMap[p.getData().getText()])).getdoubleValue();
         p1.Data = p.getData().getText() == null ? null : temp;
     }
     p1.Mode = p.getMode() == null ? 0 : int.Parse(p.getMode().getText());
     p1.Dimensions = p.getPlotType() == null ? 0 : p.getPlotType() == "2D" ? 2 : 3;
     p1.PlotTitle = p.getTitle() == null ? "" : p.getTitle().getText();
     p1.X_Fact = p.getXFact() == null ? 1.0 : double.Parse(p.getXFact().getText());
     p1.Y_Fact = p.getYFact() == null ? 1.0 : double.Parse(p.getYFact().getText());
     p1.Z_Fact = p.getZFact() == null ? 1.0 : double.Parse(p.getZFact().getText());
     p1.X_Axis_Title = p.getXTitle() == null ? "" : p.getXTitle().getText();
     p1.Y_Axis_Title = p.getYTitle() == null ? "" : p.getYTitle().getText();
     p1.Z_Axis_Title = p.getZTitle() == null ? "" : p.getZTitle().getText();
     p1.ScaleMode = p.getScaleMode() == null ? 1 : (p.getScaleMode() == "linear") ? 1 : 2;
     return (p1);
 }
コード例 #3
0
ファイル: InterpreterVisitor_.cs プロジェクト: rkpandya/pinac
        public override void VisitPlotFunctionElement(PlotFunctionElement element)
        {
            if (mVariableMap.ContainsKey(element.getData().getText()))
            {
                //   double[,] temp = ((MatrixVariableDeclaration)(mVariableMap[element.getData().getText()])).getdoubleValue();
                if (element.getPlotFunction() == "subPlot")
                {
                    int pane = int.Parse(element.getPeno().getText()); //.getPane().getText());
                    string plotType = element.getPlotType();

                    if (pane >= 4 || pane <= 0)
                    {
                        Console.Write("pane no. is not valid.. it lies between 1 to 4.. Try again..");
                        sendres(112, "pane no. is not valid.. it lies between 1 to 4.. Try again..");
                        return;
                    }
                    else if (plotType == "2D" || plotType == "1D")
                    {
                        if ((IntegerElement)(element.getMode()) != null)
                        {
                            Console.Write("Invalid argumenet.. Mode is not required.. Try again.. ");
                            sendres(112, "Invalid argumenet.. Mode is not required.... Try again..");
                            return;
                        }
                    }
                    else if (plotType == "3D")
                    {
                        int mode = int.Parse(((IntegerElement)(element.getMode())).getText());
                        if (mode > 3 || mode <= 0)
                        {
                            Console.Write("Invalid mode.. Give the input between 1..3 ");
                            sendres(112, "Invalid mode.. Give the input between 1..3 ");
                            return;
                        }
                    }
                }
                else if (element.getPlotFunction() == "plot")
                {
                    string plotType = element.getPlotType();
                    string data = element.getData().getText();
                    if (plotType == "1D" || plotType == "2D")
                    {
                        if ((IntegerElement)(element.getMode()) != null)
                        {
                            Console.Write("Invalid argumenet.. Mode is not required.. Try again.. ");
                            sendres(112, "Invalid argumenet.. Mode is not required.. Try again.. ");
                            return;
                        }
                    }
                    else if (plotType == "3D")
                    {
                        int mode = int.Parse(((IntegerElement)(element.getMode())).getText());
                        if (mode >= 3 || mode <= 0)
                        {
                            Console.Write("Invalid mode.. Give the input between 1..3 ");
                            sendres(112, "Invalid mode.. Give the input between 1..3 ");
                            return;
                        }

                    }
                }
                else if (element.getPlotFunction() == "setScaleMode")
                {
                    string scaleMode = element.getScaleMode();
                    if (scaleMode != "log" || scaleMode != "linear")
                    {
                        Console.Write("Invalid scale mode.. it should be either 'linear' or 'log'");
                        sendres(112, "Invalid scale mode.. it should be either 'linear' or 'log'");
                        return;
                    }
                }

                Plot pr = new Plot();
                pr = convert_Ele_to_plot(element);
                p.writetolist(pr);
            }
            else
            {
                Console.Write("Plot data not declared.. Try again..");
                sendres(112, "Plot data not declared.. Try again..");
                return;
            }

        }
コード例 #4
0
ファイル: PrettyPrintVisitor.cs プロジェクト: shranjan/pinac
  //public override void VisitPlotFunctionElement(PlotFunctionElement element)
  //{
  //    Console.WriteLine("Inside visit plot function..\n");
  //    //VisitElement(element.getData());

  //    if (element.getPlotFunction() == "subPlot")
  //    {
  //        if (element.getPlotType().getText() == "1")
  //        {
  //            //-- call the 1d subplot function.
  //            Console.WriteLine("\n visited type 1 of subPlot \n");
  //        }
  //        else if (element.getPlotType().getText() == "2")
  //        {
  //            //-- call the 2d subplot function.
  //            Console.WriteLine(" visited type 2 of subPlot \n");
  //        }
  //    }
  //    else if (element.getPlotFunction() == "plot")
  //    {
  //        Console.WriteLine("\n visited Plot \n");
  //    }

  //}
  public override void VisitPlotFunctionElement(PlotFunctionElement element)
  {
      {
          Console.WriteLine("Inside visit plot function Element\n");

          if (element.getPlotFunction() == "subPlot")
          {
              if (element.getPlotType().getText() == "1")
              {
                  Console.WriteLine("subPlot of type 1D :\n");
                  Console.Write("subPlot1D(");
                  VisitElement(element.getRow()); Console.Write(",");
                  VisitElement(element.getColumn()); Console.Write(",");
                  VisitElement(element.getData()); Console.Write(",");
                  VisitElement(element.getTitle()); Console.Write(");");



              }
              else if (element.getPlotType().getText() == "2")
              {
                  //-- call the 2d subplot function.
                  Console.WriteLine("visited subPlot type 2D \n");
                  Console.WriteLine("subPlot of type 2D :\n");
                  Console.Write("subPlot2D(");
                  VisitElement(element.getRow()); Console.Write(",");
                  VisitElement(element.getColumn()); Console.Write(",");
                  VisitElement(element.getData()); Console.Write(",");
                  VisitElement(element.getTitle()); Console.Write(");");
              }
              else if (element.getPlotType().getText() == "3")
              {
                  //-- call the 3d subplot function.
                  ///-- MODE: TBD
                  ///-- CHANGE: MODE TO A DEFAULT VALUE:

                  Console.WriteLine("visited subPlot type 3D \n");
                  Console.WriteLine("subPlot of type 3D :\n");
                  Console.Write("subPlot3D(");
                  VisitElement(element.getRow()); Console.Write(",");
                  VisitElement(element.getColumn()); Console.Write(",");
                  VisitElement(element.getData()); Console.Write(",");
                  VisitElement(element.getMode()); Console.Write(",");
                  VisitElement(element.getTitle()); Console.Write(");");
              }
          }
          else if (element.getPlotFunction() == "plot")
          {
              Console.WriteLine("\n visited plot \n");
          }
          else if (element.getPlotFunction() == "resetPlot")
          {
              Console.WriteLine("\n visited resetPlot \n");
          }
          else if (element.getPlotFunction() == "setPlotAxis")
          {
              Console.WriteLine("\n visited setPlotAxis \n");
          }
          else if (element.getPlotFunction() == "setPlotAxisTitle")
          {
              Console.WriteLine("\n visited setPlotAxisTitle\n");
          }
          else if (element.getPlotFunction() == "setScaleMode")
          {
              Console.WriteLine("\n visited setScaleMode \n");
          }

      }


  }