Beispiel #1
0
void ParmLinkMgr::ReadLinks(xmlNodePtr root, vector< Geom* > & geomVec)
{
	vector< Geom* > gVec = geomVec;
	gVec.push_back( aircraftPtr->getUserGeom() );

	xmlNodePtr node_list = xmlGetNode( root, "ParmLink_List", 0 );
	if ( node_list  )
	{
		int num_links = xmlGetNumNames( node_list, "Link" );
		for ( int i = 0 ; i < num_links ; i++ )
		{
			xmlNodePtr link_node = xmlGetNode( node_list, "Link", i );
			if ( link_node )
			{
				int geomA_id = xmlFindInt( link_node, "GeomA", 0 );
				Stringc groupA_name = Stringc( xmlFindString( link_node, "GroupA", " " ) );
				Stringc parmA_name =  Stringc( xmlFindString( link_node, "ParmA", " " ) );

				Parm* parmA = FindParm( gVec, geomA_id, groupA_name, parmA_name );

				int geomB_id = xmlFindInt( link_node, "GeomB", 0 );
				Stringc groupB_name = Stringc( xmlFindString( link_node, "GroupB", " " ) );
				Stringc parmB_name = Stringc( xmlFindString( link_node, "ParmB", " " ) );

				Parm* parmB = FindParm( gVec, geomB_id, groupB_name, parmB_name );


				if ( parmA && parmB )
				{
					ParmLink* pl = new ParmLink();

					pl->SetParmA( parmA );
					pl->SetParmB( parmB );

					pl->SetOffsetFlag( !!xmlFindInt( link_node, "OffsetFlag", 0 ) );
					pl->SetOffset( xmlFindDouble( link_node, "Offset", 0.0 ) );
					pl->SetScaleFlag( !!xmlFindInt( link_node, "ScaleFlag", 0 ) );
					pl->SetScale( xmlFindDouble( link_node, "Scale", 1.0 ) );

					pl->SetLowerLimitFlag( !!xmlFindInt( link_node, "LowerLimitFlag", 0 ) );
					pl->SetLowerLimit( xmlFindDouble( link_node, "LowerLimit", 0.0 ) );
					pl->SetUpperLimitFlag( !!xmlFindInt( link_node, "UpperLimitFlag", 0 ) );
					pl->SetUpperLimit( xmlFindDouble( link_node, "UpperLimit", 0.0 ) );

					pl->GetParmA()->set_linked_flag( true );
					pl->GetParmB()->set_linked_flag( true );

					m_ParmLinkVec.push_back( pl );
					m_CurrParmLinkIndex = (int)m_ParmLinkVec.size() - 1;
				}
			}
		}
	}
}
Beispiel #2
0
void TextLabel::readTextLabel(Aircraft * airPtr, xmlNodePtr root)
{
	xmlNodePtr text_node = xmlGetNode( root, "Text_Parms", 0 );
	if ( text_node )
	{
		vertex1.read(airPtr, text_node, "Vertex1_Parms");
		textOffset = xmlFindDouble(text_node, "TextOffset", textOffset);
		fixedLabelFlag = xmlFindInt( text_node, "FixedLabelFlag", fixedLabelFlag ) != 0;
		fixedPos[0] = xmlFindDouble(text_node, "FixedPosX", fixedPos[0] );
		fixedPos[1] = xmlFindDouble(text_node, "FixedPosY", fixedPos[1] );
	}
}
Beispiel #3
0
void RulerLabel::readRulerLabel(Aircraft * airPtr, xmlNodePtr root)
{
	xmlNodePtr ruler_node = xmlGetNode( root, "Ruler_Parms", 0 );
	if ( ruler_node )
	{
		vertex2.read(airPtr, ruler_node, "Vertex2_Parms");
		rulerOffset = xmlFindDouble(ruler_node, "RulerOffset", rulerOffset);
		attachState = xmlFindInt(ruler_node, "AttachState", attachState);
		xLock = xmlFindInt(ruler_node, "XLock", xLock);
		yLock = xmlFindInt(ruler_node, "YLock", yLock);
		zLock = xmlFindInt(ruler_node, "ZLock", zLock);
		rulerDistance = xmlFindDouble(ruler_node, "RulerDistance", rulerDistance);

		precision = xmlFindInt(ruler_node, "Precision", precision);
		unitString = xmlFindString(ruler_node, "UnitString", unitString.get_char_star());
	}
}
Beispiel #4
0
void LabelGeom::readLabelGeom(xmlNodePtr root)
{
	xmlNodePtr label_node;

	//===== Read Parameters =====//
	label_node = xmlGetNode( root, "Label_Parms", 0 );
	if ( label_node )
	{
//		type = xmlFindInt( label_node, "TypeInt", type );
//		type_str = xmlFindString( label_node, "TypeStr", type_str.get_char_star());
		name_str = xmlFindString( label_node, "NameStr", name_str.get_char_star());

		color.set_x( xmlFindDouble( label_node, "ColorR", color.x() ) );
		color.set_y( xmlFindDouble( label_node, "ColorG", color.y() ) );
		color.set_z( xmlFindDouble( label_node, "ColorB", color.z() ) );

		drawMode = xmlFindInt( label_node, "DrawMode", drawMode );
		textSize = (float)xmlFindDouble( label_node, "TextSize", textSize );
		viewScale = xmlFindDouble( label_node, "ViewScale", viewScale );
	}
}
Beispiel #5
0
void UserGeom::read(xmlNodePtr root)
{
	xmlNodePtr node;
	node = xmlGetNode( root, "User_Parms", 0 );

	if ( node )
	{
		userParm1    =  xmlFindDouble( node, "User1", userParm1() );
		userParm2    =  xmlFindDouble( node, "User2", userParm2() );
		userParm3    =  xmlFindDouble( node, "User3", userParm3() );
		userParm4    =  xmlFindDouble( node, "User4", userParm4() );
		userParm5    =  xmlFindDouble( node, "User5", userParm5() );
		userParm6    =  xmlFindDouble( node, "User6", userParm6() );
		userParm7    =  xmlFindDouble( node, "User7", userParm7() );
		userParm8    =  xmlFindDouble( node, "User8", userParm8() );
	}

}
Beispiel #6
0
//==== Read External File ====//
void PropGeom::read(xmlNodePtr root)
{
  int i;

  xmlNodePtr node;

  //===== Read General Parameters =====//
  node = xmlGetNode( root, "General_Parms", 0 );
  if ( node )
    read_general_parms( node );

  //===== Read Fuse Parameters =====//
  node = xmlGetNode( root, "Prop_Parms", 0 );
  if ( node )
  {
	numBlades   =  xmlFindInt( node, "NumBlades", numBlades );
	smoothFlag  =  xmlFindInt( node, "SmoothFlag", smoothFlag );
	numU        =  xmlFindInt( node, "NumU", numU );
	numW        =  xmlFindInt( node, "NumW", numW );

	diameter    =  xmlFindDouble( node, "Diameter", diameter() );
	cone_angle  =  xmlFindDouble( node, "ConeAngle", diameter() );
	pitch       =  xmlFindDouble( node, "Pitch", diameter() );

	int num_sects = xmlGetNumNames( node, "Sect_Parms" );

	if ( num_sects >= 2 )
	{
		//==== Delete Old Sect Vec ====//
		DeleteAllFoilsAndSects();

		//for ( i = 0 ; i < (int)sectVec.size() ; i++ )
		//{
		//	RemoveFoilParmReferences( sectVec[i].foil );
		//	delete sectVec[i].foil;
		//}

		sectVec.resize( num_sects );

		for ( i = 0 ; i < (int)sectVec.size() ; i++ )
		{
			xmlNodePtr sect_node = xmlGetNode( node, "Sect_Parms", i );

			sectVec[i].chord = xmlFindDouble( sect_node, "Chord", sectVec[i].chord() );
			sectVec[i].x_off = xmlFindDouble( sect_node, "X_Off", sectVec[i].x_off() );
			sectVec[i].y_off = xmlFindDouble( sect_node, "Y_Off", sectVec[i].y_off() );
			sectVec[i].twist = xmlFindDouble( sect_node, "Twist", sectVec[i].twist() );

			sectVec[i].foil = new Af(this);
			sectVec[i].foil->init_script(Stringc("prop_foil"));

			xmlNodePtr af_node = xmlGetNode( sect_node, "Airfoil", 0 );
			if ( af_node )
				sectVec[i].foil->read( af_node);
			sectVec[i].foil->set_num_pnts( numPnts.iget() );
			sectVec[i].foil->generate_airfoil();
			sectVec[i].foil->load_name();
		}
	}

	chord  = sectVec[0].chord;
	loc    = sectVec[0].x_off;
	offset = sectVec[0].y_off;
	twist  = sectVec[0].twist;
  }

  currSectID = 0;

  generate();
  parmLinkMgrPtr->RebuildAll();

}
Beispiel #7
0
//==== Read Fuse Cross Section File ====//
void FuselageXSec::read_parms(xmlNodePtr node)
{
	int i;
	xstype = xmlFindInt( node, "Type", xstype );

	height =  xmlFindDouble( node, "Height", height() );
	width  =  xmlFindDouble( node, "Width",  width() );

	max_width_loc  = xmlFindDouble( node, "Max_Width_Location",  max_width_loc() );
	corner_rad     = xmlFindDouble( node, "Corner_Radius",  corner_rad() );
	top_tan_angle = xmlFindDouble( node, "Top_Tan_Angle", top_tan_angle());
	bot_tan_angle = xmlFindDouble( node, "Bot_Tan_Angle", bot_tan_angle());

	top_str  = xmlFindDouble( node, "Top_Tan_Strength",    top_str() );
	upp_str  = xmlFindDouble( node, "Upper_Tan_Strength",  upp_str() );
	low_str  = xmlFindDouble( node, "Lower_Tan_Strength",  low_str() );
	bot_str  = xmlFindDouble( node, "Bottom_Tan_Strength", bot_str() );

	if ( xstype == FXS_FROM_FILE )
	{
		xstype = FXS_GENERAL;				// If this fails fall back on something...

		fileName = Stringc( xmlFindString( node, "File_Name", "File_Xsec" ) );					// fileName is a Stringc

		xmlNodePtr yn = xmlGetNode( node, "File_Y_Pnts", 0 );
		xmlNodePtr zn = xmlGetNode( node, "File_Z_Pnts", 0 );

		if ( yn && zn )
		{
			int numy = xmlGetNumArray( yn, ',' );
			int numz = xmlGetNumArray( zn, ',' );
			if ( numy == numz )
			{
				int num_pnts = numy;
				double* arry = (double*)malloc( num_pnts*sizeof(double) );
				double* arrz = (double*)malloc( num_pnts*sizeof(double) );
				xmlExtractDoubleArray( yn, ',', arry, num_pnts );
				xmlExtractDoubleArray( zn, ',', arrz, num_pnts );

				xstype = FXS_FROM_FILE;	

				file_crv.init( num_pnts );
				for ( i = 0 ; i < num_pnts ; i++ )
				{
					file_crv.load_pnt( i, vec3d( 0.0, arry[i],  arrz[i] ));
				}
				free( arry );
				free( arrz );

				file_crv.comp_tans();

				vec3d top_tan = vec3d( 0.0, 1.0, 0.0 );
				double tan_mag = file_crv.get_tan(0).mag();

				file_crv.load_tan( 0, top_tan*tan_mag );

				int last_id =  file_crv.get_num_pnts() - 1;
				vec3d bot_tan = vec3d( 0.0, -1.0, 0.0 );
				tan_mag = file_crv.get_tan( last_id ).mag();
				file_crv.load_tan( last_id, bot_tan*tan_mag );
			}
		}
	}
	else if ( xstype == FXS_EDIT_CRV )
	{
		edit_crv.read( node );
	}
	set_type(xstype);  

}
Beispiel #8
0
//==== Read Fuse Cross Section File ====//
void FuselageXSec::read(xmlNodePtr node)
{
	num_pnts = xmlFindInt( node, "Num_Pnts", num_pnts );
	location = xmlFindDouble( node, "Spine_Location", location() );
	y_offset =  xmlFindDouble( node, "Y_Offset", y_offset() );
	z_offset =  xmlFindDouble( node, "Z_Offset", z_offset() );

	//==== Profile Stuff ====//
	topTanAng    = xmlFindDouble( node, "Top_Tan_Ang",   topTanAng() );
	topTanStr1   = xmlFindDouble( node, "Top_Tan_Str_1", topTanStr1() );
	topTanStr2   = xmlFindDouble( node, "Top_Tan_Str_2", topTanStr2() );

	botTanAng    = xmlFindDouble( node, "Bot_Tan_Ang",   botTanAng() );
	botTanStr1   = xmlFindDouble( node, "Bot_Tan_Str_1", botTanStr1() );
	botTanStr2   = xmlFindDouble( node, "Bot_Tan_Str_2", botTanStr2() );

	leftTanAng    = xmlFindDouble( node, "Left_Tan_Ang",   leftTanAng() );
	leftTanStr1   = xmlFindDouble( node, "Left_Tan_Str_1", leftTanStr1() );
	leftTanStr2   = xmlFindDouble( node, "Left_Tan_Str_2", leftTanStr2() );

	rightTanAng    = xmlFindDouble( node, "Right_Tan_Ang",   rightTanAng() );
	rightTanStr1   = xmlFindDouble( node, "Right_Tan_Str_1", rightTanStr1() );
	rightTanStr2   = xmlFindDouble( node, "Right_Tan_Str_2", rightTanStr2() );

	numSectInterp1  = xmlFindInt( node, "Num_Sect_Interp_1", numSectInterp1 );
	numSectInterp2  = xmlFindInt( node, "Num_Sect_Interp_2", numSectInterp2 );

	topSymFlag  = xmlFindInt( node, "Top_Sym_Flag", topSymFlag );
	sideSymFlag  = xmlFindInt( node, "Side_Sym_Flag", sideSymFlag );

	read_parms( node );
}
Beispiel #9
0
void VirtGlWindow::readFile(xmlNodePtr node)
{
	backImgScaleW = xmlFindDouble( node, "Back_Img_Scale_W", 1.0 );
	backImgScaleH = xmlFindDouble( node, "Back_Img_Scale_H", 1.0 );
	backImgOffsetX = xmlFindDouble( node, "Back_Img_Offset_X", 0.0 );
	backImgOffsetY = xmlFindDouble( node, "Back_Img_Offset_Y", 0.0 );

	xmlNodePtr user_view_list_node = xmlGetNode( node, "User_View_List", 0 );
	if ( user_view_list_node )
	{
		int num_user_views = xmlGetNumNames( user_view_list_node, "User_View" );
		for ( int i = 0 ; i < num_user_views ; i++ )
		{
			xmlNodePtr user_view_node = xmlGetNode( user_view_list_node, "User_View", i );

			if ( i < NUM_USER_VIEWS )
			{
				savedUserViewFlag[i] = xmlFindInt( user_view_node, "Saved_User_View_Flag", 0 );

				if ( savedUserViewFlag[i] )
				{
					savedRotationCenters[i].set_x( xmlFindDouble( user_view_node, "Saved_Rot_Center_X", 0.0 ) );
					savedRotationCenters[i].set_y( xmlFindDouble( user_view_node, "Saved_Rot_Center_Y", 0.0 ) );
					savedRotationCenters[i].set_z( xmlFindDouble( user_view_node, "Saved_Rot_Center_Z", 0.0 ) );
			
					savedTrackVec[i].set_scale( xmlFindDouble( user_view_node, "Track_Scale", 1.0 ) );
					double trans_x = xmlFindDouble( user_view_node, "Track_Trans_X", 0.0 );
					double trans_y = xmlFindDouble( user_view_node, "Track_Trans_Y", 0.0 );
					savedTrackVec[i].set_trans( trans_x, trans_y, 0.0 );

					double rx = xmlFindDouble( user_view_node, "Track_Spin_Rot_X", 0.0 );
					double ry = xmlFindDouble( user_view_node, "Track_Spin_Rot_Y", 0.0 );
					double rz = xmlFindDouble( user_view_node, "Track_Spin_Rot_Z", 0.0 );
					double rw = xmlFindDouble( user_view_node, "Track_Spin_Rot_W", 1.0 );

					savedTrackVec[i].set_rvec( rx, ry, rz, rw );
				}
			}
		}
	}
}
Beispiel #10
0
void Af::read(xmlNodePtr node)
{
  int i;

  int temp_type = xmlFindInt( node, "Type", 0 );
  inverted_flag = xmlFindInt( node, "Inverted_Flag", inverted_flag );

  camber        = xmlFindDouble( node, "Camber", camber() );
  camber_loc    = xmlFindDouble( node, "Camber_Loc", camber_loc() );
  thickness     = xmlFindDouble( node, "Thickness", thickness() );
  thickness_loc = xmlFindDouble( node, "Thickness_Loc", thickness_loc() );

  radius_le    = xmlFindDouble( node, "Radius_Le", radius_le() );
  radius_te    = xmlFindDouble( node, "Radius_Te", radius_te() );

  sixser = xmlFindInt( node, "Six_Series", sixser );
  ideal_cl = xmlFindDouble( node, "Ideal_Cl", ideal_cl() );
  a = xmlFindDouble( node, "A", a() );

  slat_flag = xmlFindInt( node, "Slat_Flag", slat_flag );
  slat_shear_flag = xmlFindInt( node, "Slat_Shear_Flag", slat_shear_flag );
  slat_chord = xmlFindDouble( node, "Slat_Chord", slat_chord() );
  slat_angle = xmlFindDouble( node, "Slat_Angle", slat_angle() );

  flap_flag = xmlFindInt( node, "Flap_Flag", flap_flag );
  flap_shear_flag = xmlFindInt( node, "Flap_Shear_Flag", flap_shear_flag );
  flap_chord = xmlFindDouble( node, "Flap_Chord", flap_chord() );
  flap_angle = xmlFindDouble( node, "Flap_Angle", flap_angle() );

  if ( temp_type == AIRFOIL_FILE )
  {
    vec3d pnt;
    name = xmlFindString( node, "Name", name );
    orig_af_thickness = (float)xmlFindDouble( node, "Original_AF_Thickness", orig_af_thickness );
    radius_le_correction_factor = (float)xmlFindDouble( node, "Radius_LE_Correction_Factor", radius_le_correction_factor );
    radius_te_correction_factor = (float)xmlFindDouble( node, "Radius_TE_Correction_Factor", radius_te_correction_factor );

    xmlNodePtr upp_node = xmlGetNode( node, "Upper_Pnts", 0 );

    if ( upp_node )
    {
      int num_arr =  xmlGetNumArray( upp_node, ',' );
      double* arr = (double*)malloc( num_arr*sizeof(double) );
      xmlExtractDoubleArray( upp_node, ',', arr, num_arr );

      int num_upper = num_arr/2;

      upper_curve.init(num_upper);
      for ( i = 0 ; i < num_arr ; i+=2)
      {
        pnt = vec3d(arr[i], 0.0, arr[i+1]);
        upper_curve.load_pnt( i/2, pnt );
      }
      free(arr);
    }
    xmlNodePtr low_node = xmlGetNode( node, "Lower_Pnts", 0 );

    if ( low_node )
    {
      int num_arr =  xmlGetNumArray( low_node, ',' );
      double* arr = (double*)malloc( num_arr*sizeof(double) );
      xmlExtractDoubleArray( low_node, ',', arr, num_arr );

      int num_lower = num_arr/2;

      lower_curve.init(num_lower);
      for ( i = 0 ; i < num_arr ; i+=2)
      {
        pnt = vec3d(arr[i], 0.0, arr[i+1]);
        lower_curve.load_pnt( i/2, pnt );
      }
      free(arr);
    }
  }

  set_type(temp_type);
}