Exemple #1
0
void CAttachOp::ReadDefaultValues()
{
	COp::ReadDefaultValues();

	CNCConfig config(ConfigScope());
	config.Read(wxString(GetTypeString()) + _T("Tolerance"), &m_tolerance, 0.01);
	config.Read(wxString(GetTypeString()) + _T("MinZ"), &m_min_z, 0.0);
	config.Read(wxString(GetTypeString()) + _T("MatAllowance"), &m_material_allowance, 0.0);
}
Exemple #2
0
void CAttachOp::WriteDefaultValues()
{
	COp::WriteDefaultValues();

	CNCConfig config(ConfigScope());
	config.Write(wxString(GetTypeString()) + _T("Tolerance"), m_tolerance);
	config.Write(wxString(GetTypeString()) + _T("MinZ"), m_min_z);
	config.Write(wxString(GetTypeString()) + _T("MatAllowance"), m_material_allowance);
}
Exemple #3
0
//JT
void ObjList::AuditHeeksObjTree4Constraints(HeeksObj * SketchPtr ,HeeksObj * mom, int level,bool ShowMsgInConsole,bool *ConstraintsAreOk  )
{
    wxString message=wxT("");
    message.Pad(level*3,' ',true);
    message+=wxString::Format(wxT("%s ID=%d  ") ,GetTypeString(),m_id);

    if (GetNumChildren() > 0)message+=wxString::Format(wxT("  (Kids:%d)") ,GetNumChildren());
        if (ShowMsgInConsole)wxPuts(message);

//At this point need to get some info about mom whether or not shee has kids
//What's you lastman

//How about your first name_id
//Where to you really reside in memory


    if (GetNumChildren() > 0)
    {
        std::list<HeeksObj*>::iterator It;
        for(It=m_objects.begin(); It!=m_objects.end() ;It++)
        {
            if(((*It)==NULL)||((*It)==0))
            wxMessageBox(wxT("this is a problem 201011260146"));
            (*It)->AuditHeeksObjTree4Constraints(SketchPtr ,this,level+1,ShowMsgInConsole,ConstraintsAreOk);
        }

    }
}
Exemple #4
0
void ObjList::FindConstrainedObj(HeeksObj * CurrentObject,HeeksObj * ObjectToFind,int * occurrences,int FromLevel,int Level,bool ShowMsgInConsole)
{
    //if we hit this it's the end of the line
    wxString searchmessage;


    //Moving the next two line inside the if,but it will reduce the output to view on big projectes
       searchmessage.Pad((FromLevel+1)*3+9+Level,' ');
    searchmessage += wxString::Format(wxT("%s  ID=%d  ") ,GetTypeString(),m_id);//I

    if (this == ObjectToFind)
    {
       //Originally had the next two lines outside the if,but it generated too much output to view on big projectes
       (*occurrences)++;
        searchmessage += wxT(" $$$ MATCH $$$");

    }
        if (ShowMsgInConsole)wxPuts(searchmessage);

    if (GetNumChildren() > 0)
    {
        std::list<HeeksObj*>::iterator It;
        for(It=m_objects.begin(); It!=m_objects.end() ;It++)
        {
            (*It)->FindConstrainedObj((*It),ObjectToFind, occurrences,FromLevel,Level+1,ShowMsgInConsole);
        }

    }


}
Exemple #5
0
HRESULT CMethodInfo::InitPropertyGet( ITypeInfo* pTypeInfo,	const VARDESC* pVarDesc )
{
	HRESULT hResult;
	CComBSTR bstrName;
	UINT nNames;

	DbgAssert( pTypeInfo != NULL );
	DbgAssert( pVarDesc != NULL );

	m_pIntTypeInfo = pTypeInfo;
	m_dispid = pVarDesc->memid;
	m_invkind = INVOKE_PROPERTYGET;
	m_readOnly = pVarDesc->wVarFlags&VARFLAG_FREADONLY;
	m_isHidden = pVarDesc->wVarFlags&(VARFLAG_FHIDDEN);
	m_tBindable = pVarDesc->wVarFlags&VARFLAG_FBINDABLE;
	m_tRequestEdit = pVarDesc->wVarFlags&FUNCFLAG_FREQUESTEDIT;

	hResult = pTypeInfo->GetNames( m_dispid, &bstrName, 1, &nNames );
	if( FAILED( hResult ) )
	{
		return( hResult );
	}
	DbgAssert( nNames == 1 );

	m_strName = TSTR::FromBSTR(bstrName);
	
	// get the return string
	const TYPEDESC* tdesc = &(pVarDesc->elemdescVar.tdesc);
	while (tdesc->vt == VT_PTR)
		tdesc = tdesc->lptdesc;
	GetTypeString(tdesc, m_strReturn, true, &m_spTypeInfo);

	return( S_OK );
}
BOOL CValueToolBar::GetModuleTool(CValue &rez,CValue**p)
{

	rez.CreateObject(GetTypeString());
	((CValueToolBar*)rez.pRef)->Attach(&pMainFrame->m_ToolModule);
	((CValueToolBar*)rez.pRef)->m_csName="ѕанель инструментов модул¤";
	return TRUE;
};
Exemple #7
0
Error Socket::Disconnect() const {
  if (!socket_) {
    return Error(LNR_EBADF);
  }
  const linear::Addrinfo& peer = GetPeerInfo();
  LINEAR_LOG(LOG_DEBUG, "try to disconnect: %s:%d,%s", peer.addr.c_str(), peer.port, GetTypeString(GetType()).c_str());
  return socket_->Disconnect();
}
BOOL CValueToolBar::GetEditTool(CValue &rez,CValue**p)
{

	rez.CreateObject(GetTypeString());
	((CValueToolBar*)rez.pRef)->Attach(&pMainFrame->m_ToolEdit);
	((CValueToolBar*)rez.pRef)->m_csName="ѕанель инструментов формы";
	return TRUE;
};
BOOL CValueToolBar::GetMainTool(CValue &rez,CValue**p)
{

	rez.CreateObject(GetTypeString());
	((CValueToolBar*)rez.pRef)->Attach(&pMainFrame->m_ToolMain);
	((CValueToolBar*)rez.pRef)->m_csName="ќбща¤ панель инструментов";
	return TRUE;
};
Exemple #10
0
void CKickIssue::ListIssueDetails(CBasePlayer *a2)
{
	char s[64];
	if (true)//There should be check or something
	{
		V_snprintf(s, sizeof(s), "callvote %s <userID>\n", GetTypeString());
		ClientPrint(a2, 2, s);
	}
}
Exemple #11
0
CValue CValue::Method(CString csName,CValue **aParams)
{
	GET_THIS
	int iName=FindMethod(csName);
	if(iName>=0)
		return pThis->Method(iName,aParams);

	SetError(CString("Значение не представляет агрегатный объект (")+GetTypeString()+"."+csName+")");
	return *this;
}
Exemple #12
0
bool BoxAtom::Read() {
	while (CurrentPosition() != _start + _size) {
		BaseAtom *pAtom = GetDoc()->ReadAtom(this);
		if (pAtom == NULL) {
			FATAL("Unable to read atom. Parent atom is %s",
					STR(GetTypeString()));
			return false;
		}
		if (!pAtom->IsIgnored()) {
			if (!AtomCreated(pAtom)) {
				FATAL("Unable to signal AtomCreated for atom %s (%"PRIx64")",
						STR(GetTypeString()), _start);
				return false;
			}
		}
		ADD_VECTOR_END(_subAtoms, pAtom);
	}
	return true;
}
std::string AnnotationValue::GetValueAsString() const
{
	if (!IsString())
	{
		std::stringstream ss;
		ss << "Attempted to access " << GetTypeString() 
			<< " annotation as a string.";
		throw AnnotationValueTypeException(ss.str());
	}
	return boost::get<std::string>(value);
}
Exemple #14
0
void CSPropMaterial::ShowPropertyStatus(std::ostream& stream)
{
	CSProperties::ShowPropertyStatus(stream);
	stream << " --- " << GetTypeString() << " --- " << std::endl;
	stream << "  Isotropy\t: " << bIsotropy << std::endl;
	stream << "  Epsilon_R\t: " << Epsilon[0].GetValueString() << ", "  << Epsilon[1].GetValueString() << ", "  << Epsilon[2].GetValueString()  << std::endl;
	stream << "  Kappa\t\t: " << Kappa[0].GetValueString() << ", "  << Kappa[1].GetValueString() << ", "  << Kappa[2].GetValueString()  << std::endl;
	stream << "  Mue_R\t\t: " << Mue[0].GetValueString() << ", "  << Mue[1].GetValueString() << ", "  << Mue[2].GetValueString()  << std::endl;
	stream << "  Sigma\t\t: " << Sigma[0].GetValueString() << ", "  << Sigma[1].GetValueString() << ", "  << Sigma[2].GetValueString()  << std::endl;
	stream << "  Density\t: " << Density.GetValueString() << std::endl;

}
NodePtr AnnotationValue::GetValueAsNode() const
{
	if (!IsNode())
	{
		std::stringstream ss;
		ss << "Attempted to access " << GetTypeString() 
			<< " annotation as a node.";
		throw AnnotationValueTypeException(ss.str());
	}
	Node & node = boost::get<Node &>(value);
	return NodePtr(&node);
}
AnnotationTablePtr AnnotationValue::GetValueAsTable() const
{
	if (!IsTable())
	{
		std::stringstream ss;
		ss << "Attempted to access " << GetTypeString() 
			<< " annotation as a table.";
		throw AnnotationValueTypeException(ss.str());
	}
	AnnotationTableInternalPtr table = boost::get<AnnotationTableInternalPtr>(value);
	return AnnotationTablePtr(table.get());
}
Exemple #17
0
string BoxAtom::Hierarchy(uint32_t indent) {
	string result = string(indent * 4, ' ') + GetTypeString() + "\n";
	if (_subAtoms.size() == 0) {
		result += string((indent + 1) * 4, ' ') + "[empty]";
		return result;
	}
	for (uint32_t i = 0; i < _subAtoms.size(); i++) {
		result += _subAtoms[i]->Hierarchy(indent + 1);
		if (i != _subAtoms.size() - 1)
			result += "\n";
	}
	return result;
}
Exemple #18
0
void HeeksObj::GetProperties(std::list<Property *> *list)
{
	bool editable = CanEditString();
	list->push_back(new PropertyString(_("object type"), GetTypeString(), NULL));
	if(GetShortString())list->push_back(new PropertyString(_("object title"), GetShortString(), this, editable ? on_edit_string : NULL));
	if(UsesID())list->push_back(new PropertyInt(_("ID"), m_id, this, on_set_id));
	const HeeksColor* c = GetColor();
	if(c)
	{
		list->push_back ( new PropertyColor ( _("color"),  *c, this, on_set_color ) );
	}
	list->push_back(new PropertyCheck(_("visible"), m_visible, this, on_set_visible));
}
Exemple #19
0
void CSProperties::ShowPropertyStatus(ostream& stream)
{
	stream << " Property #" << GetID() << " Type: \"" << GetTypeString() << "\" Name: \"" << GetName() << "\"" << endl;
	stream << " Primitive Count \t: " << vPrimitives.size() << endl;

	stream << "  -- Primitives: --" << endl;
	for (size_t i=0; i<vPrimitives.size();++i)
	{
		vPrimitives.at(i)->ShowPrimitiveStatus(stream);
		if (i<vPrimitives.size()-1)
			stream << " ---- " << endl;
	}
}
Exemple #20
0
void CActiveLegacyMasternodeManager::ManageStateRemote()
{
    if (deterministicMNManager->IsDeterministicMNsSporkActive()) return;

    LogPrint("masternode", "CActiveLegacyMasternodeManager::ManageStateRemote -- Start status = %s, type = %s, pinger enabled = %d, keyIDOperator = %s\n",
        GetStatus(), GetTypeString(), fPingerEnabled, activeMasternodeInfo.legacyKeyIDOperator.ToString());

    mnodeman.CheckMasternode(activeMasternodeInfo.legacyKeyIDOperator, true);
    masternode_info_t infoMn;
    if (mnodeman.GetMasternodeInfo(activeMasternodeInfo.legacyKeyIDOperator, infoMn)) {
        if (infoMn.nProtocolVersion != PROTOCOL_VERSION) {
            nState = ACTIVE_MASTERNODE_NOT_CAPABLE;
            strNotCapableReason = "Invalid protocol version";
            LogPrintf("CActiveLegacyMasternodeManager::ManageStateRemote -- %s: %s\n", GetStateString(), strNotCapableReason);
            return;
        }
        if (activeMasternodeInfo.service != infoMn.addr) {
            nState = ACTIVE_MASTERNODE_NOT_CAPABLE;
            strNotCapableReason = "Broadcasted IP doesn't match our external address. Make sure you issued a new broadcast if IP of this masternode changed recently.";
            LogPrintf("CActiveLegacyMasternodeManager::ManageStateRemote -- %s: %s\n", GetStateString(), strNotCapableReason);
            return;
        }
        if (!CMasternode::IsValidStateForAutoStart(infoMn.nActiveState)) {
            nState = ACTIVE_MASTERNODE_NOT_CAPABLE;
            strNotCapableReason = strprintf("Masternode in %s state", CMasternode::StateToString(infoMn.nActiveState));
            LogPrintf("CActiveLegacyMasternodeManager::ManageStateRemote -- %s: %s\n", GetStateString(), strNotCapableReason);
            return;
        }
        auto dmn = deterministicMNManager->GetListAtChainTip().GetMNByCollateral(infoMn.outpoint);
        if (dmn) {
            if (dmn->pdmnState->addr != infoMn.addr) {
                nState = ACTIVE_MASTERNODE_NOT_CAPABLE;
                strNotCapableReason = strprintf("Masternode collateral is a ProTx and ProTx address does not match local address");
                LogPrintf("CActiveLegacyMasternodeManager::ManageStateRemote -- %s: %s\n", GetStateString(), strNotCapableReason);
                return;
            }
            LogPrintf("CActiveLegacyMasternodeManager::ManageStateRemote -- Collateral is a ProTx\n");
        }
        if (nState != ACTIVE_MASTERNODE_STARTED) {
            LogPrintf("CActiveLegacyMasternodeManager::ManageStateRemote -- STARTED!\n");
            activeMasternodeInfo.outpoint = infoMn.outpoint;
            activeMasternodeInfo.service = infoMn.addr;
            fPingerEnabled = true;
            nState = ACTIVE_MASTERNODE_STARTED;
        }
    } else {
        nState = ACTIVE_MASTERNODE_NOT_CAPABLE;
        strNotCapableReason = "Masternode not in masternode list";
        LogPrintf("CActiveLegacyMasternodeManager::ManageStateRemote -- %s: %s\n", GetStateString(), strNotCapableReason);
    }
}
Exemple #21
0
void CWaterline::WriteDefaultValues()
{
	CDepthOp::WriteDefaultValues();

	CNCConfig config(ConfigScope());
	config.Write(wxString(GetTypeString()) + _T("BoxXMin"), m_params.m_box.m_x[0]);
	config.Write(wxString(GetTypeString()) + _T("BoxYMin"), m_params.m_box.m_x[1]);
	config.Write(wxString(GetTypeString()) + _T("BoxXMax"), m_params.m_box.m_x[3]);
	config.Write(wxString(GetTypeString()) + _T("BoxYMax"), m_params.m_box.m_x[4]);
	config.Write(wxString(GetTypeString()) + _T("StepOver"), m_params.m_step_over);
	config.Write(wxString(GetTypeString()) + _T("MatAllowance"), m_params.m_material_allowance);
	config.Write(wxString(GetTypeString()) + _T("Tolerance"), m_params.m_tolerance);
}
Exemple #22
0
void CWaterline::ReadDefaultValues()
{
	CDepthOp::ReadDefaultValues();

	CNCConfig config(ConfigScope());
	config.Read(wxString(GetTypeString()) + _T("BoxXMin"), &m_params.m_box.m_x[0], -7.0);
	config.Read(wxString(GetTypeString()) + _T("BoxYMin"), &m_params.m_box.m_x[1], -7.0);
	config.Read(wxString(GetTypeString()) + _T("BoxXMax"), &m_params.m_box.m_x[3], 7.0);
	config.Read(wxString(GetTypeString()) + _T("BoxYMax"), &m_params.m_box.m_x[4], 7.0);
	config.Read(wxString(GetTypeString()) + _T("StepOver"), &m_params.m_step_over, 1.0);
	config.Read(wxString(GetTypeString()) + _T("MatAllowance"), &m_params.m_material_allowance, 0.0);
	config.Read(wxString(GetTypeString()) + _T("Tolerance"), &m_params.m_tolerance, 0.01);
}
Exemple #23
0
void Constraint::AuditHeeksObjTree4Constraints(HeeksObj * SketchPtr ,HeeksObj * mom,int level,bool ShowMsgInConsole,bool * ConstraintsAreOk)
{
    wxString message=wxT("");
    message.Pad(level*3,' ',true);
    message +=wxString::Format(wxT("%s ID=%d \n  ") ,GetTypeString(),m_id);
    message.Pad(level*3,' ',true);

    wxString wxstr_m_type(ConstraintTypes[m_type].c_str(), wxConvUTF8);
    message += wxstr_m_type;
    message += wxT(" consists of:\n");
    message.Pad(level*3+3,' ',true);
    if (!m_obj1 ==0)
    {
        message += wxString::Format(wxT("%s id=%d(%s) -"),m_obj1->GetTypeString(),m_obj1->m_id,((m_obj1==mom)?wxT("KNOWN"):wxT("UNKNOWN")));
    }
    else
    {
        message += wxString (wxT("!!!!! m_obj1 Should Always be specified!!!!! \n"));
        *ConstraintsAreOk=false;
    }

    if (m_obj2 ==0)
    {

        if (ReturnStdObjectCtForConstraint(m_type)==2)
            {    // We have a problem where
                message += wxString (wxT("!!!!! m_obj2 not specified in two object constraint!!!!! \n"));
                *ConstraintsAreOk=false;
            }
    }
    else
    {
        message += wxString::Format(wxT("  %s id=%d(%s)\n"),m_obj2->GetTypeString(),m_obj2->m_id,((m_obj2==mom)?wxT("KNOWN"):wxT("UNKNOWN")));
        message.Pad(level*3+3,' ',true);
    }
    if (ShowMsgInConsole)
    {
        wxPuts(message);
    }
    if (*ConstraintsAreOk==true)
    {
        message = wxT("Searching:");
        *ConstraintsAreOk =ValidateConstraint2Objects(SketchPtr,mom,this,level, ShowMsgInConsole);
        if (ShowMsgInConsole)
        {
            wxPuts(message);
        }
    }
}
Exemple #24
0
CChamfer::CChamfer(	const Symbols_t &symbols,
			const int tool_number )
		: CDepthOp(GetTypeString(), NULL, tool_number, ChamferType), m_symbols(symbols)
{
    for (Symbols_t::iterator symbol = m_symbols.begin(); symbol != m_symbols.end(); symbol++)
    {
        HeeksObj *object = heeksCAD->GetIDObject( symbol->first, symbol->second );
        if (object != NULL)
        {
            if (CanAdd(object)) Add(object,NULL);
        } // End if - then
    } // End for
    m_symbols.clear();
    m_params.set_initial_values();
}
Exemple #25
0
Error Socket::Disconnect() const {
  if (!socket_) {
    return Error(LNR_EBADF);
  }
  const linear::Addrinfo& self = GetSelfInfo();
  const linear::Addrinfo& peer = GetPeerInfo();
  LINEAR_LOG(LOG_DEBUG, "try to disconnect(id = %d): %s:%d x-- %s --- %s:%d",
             GetId(),
             (self.proto == Addrinfo::IPv4) ? self.addr.c_str() : (std::string("[" + self.addr + "]")).c_str(),
             self.port,
             GetTypeString(GetType()).c_str(),
             (peer.proto == Addrinfo::IPv4) ? peer.addr.c_str() : (std::string("[" + peer.addr + "]")).c_str(),
             peer.port);
  return socket_->Disconnect();
}
CPositioning::CPositioning(	const Symbols_t &symbols )
		: COp(GetTypeString(), 0, PositioningType), m_symbols(symbols)
{
    m_params.set_initial_values();

    for (Symbols_t::const_iterator symbol = symbols.begin(); symbol != symbols.end(); symbol++)
    {
        HeeksObj *object = heeksCAD->GetIDObject( symbol->first, symbol->second );
        if (object != NULL)
        {
            Add( object, NULL );
        } // End if - then
    } // End for

    m_symbols.clear();	// we don't want to do this twice.
}
Exemple #27
0
CDrilling::CDrilling(	const Symbols_t &symbols,
        const int tool_number,
        const double depth )
    : CSpeedOp(GetTypeString(), tool_number, DrillingType), m_symbols(symbols)
{
    m_params.set_initial_values(depth, tool_number);
    for (Symbols_t::iterator itSymbol = m_symbols.begin(); itSymbol != m_symbols.end(); itSymbol++)
    {
        HeeksObj *obj = heeksCAD->GetIDObject(itSymbol->first, itSymbol->second);
        if (obj != NULL)
        {
            Add(obj, NULL);
        }
    } // End for
    m_symbols.clear();	// We don't want to convert them twice.
}
Exemple #28
0
CWaterline::CWaterline(const std::list<int> &solids, const int tool_number)
    :CDepthOp(GetTypeString(), NULL, tool_number, WaterlineType), m_solids(solids)
{
	ReadDefaultValues();

	// set m_box from the extents of the solids
	for(std::list<int>::const_iterator It = solids.begin(); It != solids.end(); It++)
	{
		int solid = *It;
		HeeksObj* object = heeksCAD->GetIDObject(SolidType, solid);
		if(object)
		{
			if(object->GetType() == StlSolidType)
			{
				object->GetBox(m_params.m_box);
			}
			else
			{
				double extents[6];
				if(heeksCAD->BodyGetExtents(object, extents))
				{
					m_params.m_box.Insert(CBox(extents));
				}
			}

			Add(object, NULL);
		}
	}
	m_solids.clear();

	SetDepthOpParamsFromBox();

	// add tool radius all around the box
	if(m_params.m_box.m_valid)
	{
		CTool *pTool = CTool::Find(m_tool_number);
		if(pTool)
		{
			double extra = pTool->m_params.m_diameter/2 + 0.01;
			m_params.m_box.m_x[0] -= extra;
			m_params.m_box.m_x[1] -= extra;
			m_params.m_box.m_x[3] += extra;
			m_params.m_box.m_x[4] += extra;
		}
	}
}
Exemple #29
0
CAttachOp::CAttachOp(const std::list<int> &solids, double tol, double min_z):COp(GetTypeString(), 0, AttachOpType), m_solids(solids), m_tolerance(tol), m_min_z(min_z)
{
	ReadDefaultValues();

#ifdef OP_SKETCHES_AS_CHILDREN
	for(std::list<int>::const_iterator It = solids.begin(); It != solids.end(); It++)
	{
		int solid = *It;
		HeeksObj* object = heeksCAD->GetIDObject(SolidType, solid);
		if(object)
		{
			Add(object, NULL);
		}
	}
	m_solids.clear();
#endif
}
Exemple #30
0
CProfile::CProfile(const std::list<int> &sketches, const int tool_number )
		: 	CDepthOp(GetTypeString(), &sketches, tool_number, ProfileType),
			m_tags(NULL), m_sketches(sketches)
{
    ReadDefaultValues();
#ifdef OP_SKETCHES_AS_CHILDREN
    for (std::list<int>::iterator id = m_sketches.begin(); id != m_sketches.end(); id++)
    {
        HeeksObj *object = heeksCAD->GetIDObject( SketchType, *id );
        if (object != NULL)
        {
            Add( object, NULL );
        }
    }

    m_sketches.clear();
#endif
} // End constructor