+ //submodel_iterator = submodels.begin();
+
+ //int subcount = 0;
+
+ //while (submodel_iterator != submodels.end()) {
+ // int id = (*submodel_iterator)->id;
+ // subcount++;
+
+ // SG_LOG(SG_AI, SG_ALERT,"after pushback "
+ // << " parent id " << id
+ // << " name " << (*submodel_iterator)->name
+ // << " sub id " << (*submodel_iterator)->sub_id
+ // << " subcount "<< subcount);
+
+ // ++submodel_iterator;
+ //}
+}
+
+SGVec3d FGSubmodelMgr::getCartOffsetPos() const{
+
+ // convert geodetic positions to geocentered
+ SGVec3d cartuserPos = SGVec3d::fromGeod(userpos);
+ // Transform to the right coordinate frame, configuration is done in
+ // the x-forward, y-right, z-up coordinates (feet), computation
+ // in the simulation usual body x-forward, y-right, z-down coordinates
+ // (meters) )
+
+ SGVec3d _off(_x_offset * SG_FEET_TO_METER,
+ _y_offset * SG_FEET_TO_METER,
+ -_z_offset * SG_FEET_TO_METER);
+
+ // Transform the user position to the horizontal local coordinate system.
+ SGQuatd hlTrans = SGQuatd::fromLonLat(userpos);
+
+ // and postrotate the orientation of the user model wrt the horizontal
+ // local frame
+ hlTrans *= SGQuatd::fromYawPitchRollDeg(
+ IC.azimuth,
+ IC.elevation,
+ IC.roll);
+
+ // The offset converted to the usual body fixed coordinate system
+ // rotated to the earth-fixed coordinates axis
+ SGVec3d off = hlTrans.backTransform(_off);
+
+ // Add the position offset of the user model to get the geocentered position
+ SGVec3d offsetPos = cartuserPos + off;
+ return offsetPos;
+}
+
+void FGSubmodelMgr::setOffsetPos(){
+ // convert the offset geocentered position to geodetic
+ SGVec3d cartoffsetPos = getCartOffsetPos();
+
+ SGGeodesy::SGCartToGeod(cartoffsetPos, offsetpos);
+
+ //cout << "OFFSET POS" << offsetpos.getElevationFt();
+
+}
+
+void FGSubmodelMgr::valueChanged(SGPropertyNode *prop)
+{
+ return; // this isn't working atm
+
+ const char* _model_added = _model_added_node->getStringValue();
+
+ basic_string <char>::size_type indexCh2b;
+
+ string str2 = _model_added;
+ const char *cstr2b = "multiplayer";
+ indexCh2b = str2.find( cstr2b, 0 );
+
+ if (indexCh2b != string::npos ){ // we will ignore Ballistic Objects - there are potentially too many
+
+ //cout << "Submodels: model added - " << str2 <<" read path "<< endl;
+ //return;
+ SGPropertyNode *a_node = fgGetNode(_model_added, true);
+ SGPropertyNode *sub_node = a_node->getChild("sim", 0, true);
+ SGPropertyNode_ptr path_node = sub_node->getChild("path", 0, true);
+ SGPropertyNode_ptr callsign_node = a_node->getChild("callsign", 0, true);
+
+ string callsign = callsign_node->getStringValue();
+
+ //cout << "Submodels: model added - " << callsign <<" read callsign "<< endl;
+ return;
+
+ } else {
+ cout << "model added - " << str2 <<" returning "<< endl;
+ return;
+ }