Advertisement
Broatlas

GraphicElement.cpp

Nov 30th, 2016
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.25 KB | None | 0 0
  1. //GraphicElement.cpp
  2. #include <iostream>
  3. #include <string>
  4. #include "GraphicElement.h"
  5.  
  6. using namespace std;
  7.  
  8. GraphicElement::GraphicElement(Shape** s, char* n, unsigned int i){
  9.     //add each shape to the vector arry of shapes.
  10.     double x_1, y_1, x_2, y_2;
  11.     char* nameOfShape;
  12.     char type;
  13.     strcpy(name, n); // copy over the name of the element.
  14.     for (int j = 0; j < i; j++){
  15.        
  16.         cout << "Please enter the type( L for line, R for rectangle, E for ellipse) for Shape #" << j << endl;
  17.         cin >> type;
  18.         type = toupper(type);
  19.         if (type == 'L'){
  20.             cout << "Please enter the name of the new line(<256 characters): ";
  21.             cin >> name;
  22.             cout << endl;
  23.             cout << "please enter the coordinates of the start point: (x,y) ";
  24.             cin >> x_1;
  25.             cout << " ";
  26.             cin >> y_1;
  27.             cout << endl;
  28.             cout << "please enter the coordinates of the end point: (x,y) ";
  29.             cin >> x_2;
  30.             cout << " ";
  31.             cin >> y_2;
  32.             cout << endl;
  33.  
  34.            
  35.             this->push_back(Line*(nameOfShape, Pair(x_1, y_1), Pair(x_2, y_2)));
  36.  
  37.         }
  38.         if (type == 'R'){
  39.            
  40.         }
  41.         if (type == 'E'){
  42.            
  43.         }
  44.     }
  45.  
  46. }
  47.  
  48. GraphicElement::GraphicElement(const GraphicElement& gElement){
  49.  
  50.     *this = gElement;
  51. }
  52.  
  53. GraphicElement& GraphicElement::operator=(GraphicElement& gElement){
  54.  
  55.     return *this;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement