bool AnnularSectorZone::IsInSector(const AircraftState &ref) const { GeoVector f(GetReference(), ref.location); return (f.distance <= GetRadius()) && (f.distance >= inner_radius) && IsAngleInSector(f.bearing); }
bool AnnularSectorZone::IsInSector(const GeoPoint &location) const { GeoVector f(GetReference(), location); return (f.distance <= GetRadius()) && (f.distance >= inner_radius) && IsAngleInSector(f.bearing); }
OZBoundary FAISectorZone::GetBoundary() const { OZBoundary boundary; boundary.push_front(GetSectorEnd()); boundary.push_front(GetSectorStart()); boundary.push_front(GetReference()); return boundary; }
wxString MODULE::GetSelectMenuText() const { wxString text; text.Printf( _( "Footprint %s on %s" ), GetChars ( GetReference() ), GetChars ( GetLayerName() ) ); return text; }
/***************************************************************************** * Render: displays previously rendered output ***************************************************************************** * This function send the currently rendered image to adjust modified image, * waits until it is displayed and switch the two rendering buffers, preparing * next frame. *****************************************************************************/ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) { picture_t *p_outpic; filter_sys_t *p_sys = p_filter->p_sys; int i_simthres = atomic_load( &p_sys->i_simthres ); int i_satthres = atomic_load( &p_sys->i_satthres ); int i_color = atomic_load( &p_sys->i_color ); if( !p_pic ) return NULL; p_outpic = filter_NewPicture( p_filter ); if( !p_outpic ) { picture_Release( p_pic ); return NULL; } /* Copy the Y plane */ plane_CopyPixels( &p_outpic->p[Y_PLANE], &p_pic->p[Y_PLANE] ); /* * Do the U and V planes */ int refu, refv, reflength; GetReference( &refu, &refv, &reflength, i_color ); for( int y = 0; y < p_pic->p[U_PLANE].i_visible_lines; y++ ) { uint8_t *p_src_u = &p_pic->p[U_PLANE].p_pixels[y * p_pic->p[U_PLANE].i_pitch]; uint8_t *p_src_v = &p_pic->p[V_PLANE].p_pixels[y * p_pic->p[V_PLANE].i_pitch]; uint8_t *p_dst_u = &p_outpic->p[U_PLANE].p_pixels[y * p_outpic->p[U_PLANE].i_pitch]; uint8_t *p_dst_v = &p_outpic->p[V_PLANE].p_pixels[y * p_outpic->p[V_PLANE].i_pitch]; for( int x = 0; x < p_pic->p[U_PLANE].i_visible_pitch; x++ ) { if( IsSimilar( *p_src_u - 0x80, *p_src_v - 0x80, refu, refv, reflength, i_satthres, i_simthres ) ) { *p_dst_u++ = *p_src_u; *p_dst_v++ = *p_src_v; } else { *p_dst_u++ = 0x80; *p_dst_v++ = 0x80; } p_src_u++; p_src_v++; } } return CopyInfoAndRelease( p_outpic, p_pic ); }
//---------------------------------------------------------------------------------------------- void Comp_MaterialEffectLava::Initialize() { Super::Initialize(); GetRenderComponent()->EnterCS(); std::string sFilename; pMaterialEffectLava->Load(FindFile(GetReference(), &sFilename) ? sFilename.c_str() : ""); GetRenderComponent()->LeaveCS(); }
OZBoundary KeyholeZone::GetBoundary() const { OZBoundary boundary; boundary.push_front(GetSectorStart()); boundary.push_front(GetSectorEnd()); boundary.GenerateArcExcluding(GetReference(), GetRadius(), GetStartRadial(), GetEndRadial()); const fixed small_radius = GetInnerRadius(); GeoVector small_vector(small_radius, GetStartRadial()); boundary.push_front(small_vector.EndPoint(GetReference())); small_vector.bearing = GetEndRadial(); boundary.push_front(small_vector.EndPoint(GetReference())); boundary.GenerateArcExcluding(GetReference(), small_radius, GetEndRadial(), GetStartRadial()); return std::move(boundary); }
OZBoundary CylinderZone::GetBoundary() const { OZBoundary boundary; const unsigned steps = 20; const Angle delta = Angle::FullCircle() / steps; GeoVector vector(GetRadius(), Angle::Zero()); for (unsigned i = 0; i < steps; ++i, vector.bearing += delta) boundary.push_front(vector.EndPoint(GetReference())); return boundary; }
GeoPoint CylinderZone::GetRandomPointInSector(const fixed mag) const { GeoPoint location; do { Angle dir = Angle::Degrees(fixed(rand() % 360)); fixed dmag = std::max(std::min(radius, fixed(100.0)), radius * mag); fixed dis = fixed((0.1 + (rand() % 90) / 100.0)) * dmag; GeoVector vec(dis, dir); location = vec.EndPoint(GetReference()); } while (!IsInSector(location)); return location; }
void Texmaps::RescaleWorldUnits(float f) { if (TestAFlag(A_WORK1)) return; SetAFlag(A_WORK1); // This code will be replaced in particular implementations for (int i=0; i<NumRefs(); i++) { if ( (i&1) ==0) continue; // skip the amount controllers ReferenceMaker *srm = GetReference(i); if (srm) { srm->RescaleWorldUnits(f); } } }
RefTargetHandle mrTwoSidedShader::Clone(RemapDir &remap) { mrTwoSidedShader* pNew = new mrTwoSidedShader(true); int count = NumRefs(); for(int i = 0; i < count; ++i) { ReferenceTarget* refTarg = GetReference(i); pNew->ReplaceReference(i, ((refTarg != NULL) ? remap.CloneRef(refTarg) : NULL)); } pNew->MtlBase::operator=(*this); BaseClone(this, pNew, remap); return pNew; }
void UtilityVisitor::endElement(const char *name) { const char *data = m_data.c_str(); if (m_state == 4) // Coordinate of the pylon { if (!strcmp(name, "gml:coordinates")) { double x, y; sscanf(data, "%lf,%lf", &x, &y); m_pRoute->AddPoint(DPoint2(x,y), GetReference()); // now set also the rotation !!!! HOW?? TODO m_state = 3; } } }
int CLabel::GetReference( int id ) { // 参照回数を取得する(依存関係も含める) // int total; LABREL *rel; LABOBJ *lab=&mem_lab[id]; total = lab->ref; rel = lab->rel; if ( rel != NULL ) { while(1) { total += GetReference( rel->rel_id ); if ( rel->link == NULL ) break; rel = rel->link; } } return total; }
// World scaling void EditPatchMod::RescaleWorldUnits(float f) { if (TestAFlag(A_WORK1)) return; SetAFlag(A_WORK1); // rescale all our references for (int i = 0; i < NumRefs(); i++) { ReferenceMaker *srm = GetReference(i); if (srm) srm->RescaleWorldUnits(f); } // Now rescale stuff inside our data structures EPModContextEnumProc proc(f); EnumModContexts(&proc); NotifyDependents(FOREVER, PART_GEOM, REFMSG_CHANGE); }
wxString MODULE::GetReferencePrefix() const { wxString prefix = GetReference(); int strIndex = prefix.length() - 1; while( strIndex >= 0 ) { const wxUniChar chr = prefix.GetChar( strIndex ); // numeric suffix if( chr >= '0' && chr <= '9' ) break; strIndex--; } prefix = prefix.Mid( 0, strIndex ); return prefix; }
GeoPoint SectorZone::GetBoundaryParametric(fixed t) const { const Angle sweep = (end_radial - start_radial).AsBearing(); const fixed l = GetRadius(); const fixed c1 = sweep.Radians() * GetRadius(); const fixed tt = t * (c1 + 2 * l); Angle a; fixed d; if (tt < l) { d = (tt / l) * GetRadius(); a = start_radial; } else if (tt < l + c1) { d = GetRadius(); a = start_radial + Angle::Radians(((tt - l) / c1) * sweep.Radians()); } else { d = GetRadius() - (tt - l - c1) / l * GetRadius(); a = end_radial; } return GeoVector(d, a).EndPoint(GetReference()); }
bool CSceneObject::GetSummaryInfo(SSceneSummary* inf) { inherited::GetSummaryInfo (inf); CEditableObject* E = GetReference(); R_ASSERT(E); if (IsStatic()||IsMUStatic()){ for(SurfaceIt s_it=E->m_Surfaces.begin(); s_it!=E->m_Surfaces.end(); s_it++){ float area = 0.f; float pixel_area = 0.f; for(EditMeshIt m = E->Meshes().begin();m!=E->Meshes().end();m++){ area += (*m)->CalculateSurfaceArea(*s_it,true); pixel_area += (*m)->CalculateSurfacePixelArea(*s_it,true); } inf->AppendTexture(ChangeFileExt(AnsiString(*(*s_it)->m_Texture),"").LowerCase().c_str(),SSceneSummary::sttBase,area,pixel_area,E->m_LibName.c_str()); } if (m_Flags.is(CEditableObject::eoUsingLOD)){ inf->AppendTexture(E->GetLODTextureName().c_str(),SSceneSummary::sttLOD,0,0,"$LOD$"); inf->lod_objects.insert (E->m_LibName.c_str()); inf->object_lod_ref_cnt++; } if (m_Flags.is(CEditableObject::eoMultipleUsage)){ inf->mu_objects.insert(E->m_LibName.c_str()); inf->object_mu_ref_cnt++; } inf->face_cnt += E->GetFaceCount (); inf->vert_cnt += E->GetVertexCount(); } if (m_Flags.is(CEditableObject::eoHOM)){ inf->hom_face_cnt += E->GetFaceCount (); inf->hom_vert_cnt += E->GetVertexCount(); } if (m_Flags.is(CEditableObject::eoSoundOccluder)){ inf->snd_occ_face_cnt += E->GetFaceCount(); inf->snd_occ_vert_cnt += E->GetVertexCount(); } inf->AppendObject (E->GetName()); return true; }
bool CSceneObject::Validate(bool bMsg) { CEditableObject* E = GetReference(); R_ASSERT(E); return E->Validate(); }
int main(int argc,char **argv) { URL *Url; URL **list,*refresh; int j; if(argc==1) {fprintf(stderr,"usage: test-doc URL < contents-of-url\n");return(1);} StderrLevel=ExtraDebug; InitErrorHandler("test-doc",0,1); InitConfigurationFile("./wwwoffle.conf"); init_io(STDERR_FILENO); if(ReadConfigurationFile(STDERR_FILENO)) PrintMessage(Fatal,"Error in configuration file 'wwwoffle.conf'."); finish_io(STDERR_FILENO); Url=SplitURL(argv[1]); init_io(0); ParseDocument(0,Url,1); if((refresh=GetReference(RefMetaRefresh))) printf("Refresh = %s\n",refresh->file); if((list=GetReferences(RefStyleSheet))) for(j=0;list[j];j++) printf("StyleSheet = %s\n",list[j]->file); if((list=GetReferences(RefImage))) for(j=0;list[j];j++) printf("Image = %s\n",list[j]->file); if((list=GetReferences(RefFrame))) for(j=0;list[j];j++) printf("Frame = %s\n",list[j]->file); if((list=GetReferences(RefScript))) for(j=0;list[j];j++) printf("Script = %s\n",list[j]->file); if((list=GetReferences(RefObject))) for(j=0;list[j];j++) printf("Object = %s\n",list[j]->file); if((list=GetReferences(RefInlineObject))) for(j=0;list[j];j++) printf("InlineObject = %s\n",list[j]->file); if((list=GetReferences(RefLink))) for(j=0;list[j];j++) printf("Link = %s\n",list[j]->file); FreeURL(Url); finish_io(0); return(0); }
Animatable* SubAnim(int i) {return GetReference(i);}
/*---------------------------------------------------------------------- AttachMandatoryAttrSRule verifie que l'element pEl possede les attributs requis indique's dans la regle pSRule du schema de structure pSS et, si certains attributs requis manquent, force l'utilisateur a leur donner une valeur et met ces attributs sur l'element pEl. ----------------------------------------------------------------------*/ static void AttachMandatoryAttrSRule (PtrElement pEl, PtrDocument pDoc, SRule *pSRule, PtrSSchema pSS) { #ifndef NODISPLAY int len; #endif /* NODISPLAY */ PtrAttribute pAttr, pA; PtrReference pRef; ThotBool found; ThotBool MandatoryAttrOK = FALSE; NotifyAttribute notifyAttr; int i, att; /* parcourt tous les attributs locaux definis dans la regle */ for (i = 0; (pDoc->DocSSchema != NULL) && (i < pSRule->SrNLocalAttrs); i++) if (pSRule->SrRequiredAttr->Bln[i]) /* cet attribut local est obligatoire */ if (pDoc->DocSSchema != NULL) /* le document n'a pas ete ferme' entre-temps */ { att = pSRule->SrLocalAttr->Num[i]; /* cherche si l'element possede cet attribut */ pAttr = pEl->ElFirstAttr; found = FALSE; while (pAttr != NULL && !found) if (pAttr->AeAttrNum == att && (att == 1 || !strcmp (pAttr->AeAttrSSchema->SsName, pSS->SsName))) /* att = 1: Langue, quel que soit le schema de structure */ found = TRUE; else pAttr = pAttr->AeNext; if (!found) /* l'element ne possede pas cet attribut requis */ { /* envoie l'evenement AttrCreate.Pre */ notifyAttr.event = TteAttrCreate; notifyAttr.document = (Document) IdentDocument (pDoc); notifyAttr.element = (Element) pEl; notifyAttr.info = 0; /* not sent by undo */ notifyAttr.attribute = NULL; notifyAttr.attributeType.AttrSSchema = (SSchema) pSS; notifyAttr.attributeType.AttrTypeNum = att; CallEventAttribute (¬ifyAttr, TRUE); /* cree un nouvel attribut pour l'element */ GetAttribute (&pAttr); pAttr->AeAttrSSchema = pSS; pAttr->AeAttrNum = att; pAttr->AeDefAttr = FALSE; pAttr->AeAttrType = pSS->SsAttribute->TtAttr[att - 1]->AttrType; switch (pAttr->AeAttrType) { case AtNumAttr: case AtEnumAttr: pAttr->AeAttrValue = 0; break; case AtReferenceAttr: /* attache un bloc reference a l'attribut */ GetReference (&pRef); pAttr->AeAttrReference = pRef; pRef->RdElement = pEl; pRef->RdAttribute = pAttr; break; case AtTextAttr: pAttr->AeAttrText = NULL; break; default: break; } /* attache l'attribut a l'element */ if (pEl->ElFirstAttr == NULL) /* c'est le 1er attribut de l'element */ pEl->ElFirstAttr = pAttr; else { pA = pEl->ElFirstAttr; /* 1er attribut de l'element */ while (pA->AeNext != NULL) /* cherche le dernier attribut de l'element */ pA = pA->AeNext; /* chaine le nouvel attribut */ pA->AeNext = pAttr; } /* c'est le dernier attribut de l'element */ pAttr->AeNext = NULL; /* envoie l'evenement AttrModify.Pre */ notifyAttr.event = TteAttrModify; notifyAttr.document = (Document) IdentDocument (pDoc); notifyAttr.element = (Element) pEl; notifyAttr.info = 0; /* not sent by undo */ notifyAttr.attribute = (Attribute) pAttr; notifyAttr.attributeType.AttrSSchema = (SSchema) pSS; notifyAttr.attributeType.AttrTypeNum = att; if (!CallEventAttribute (¬ifyAttr, TRUE)) /* l'application laisse l'editeur saisir la valeur de */ /* l'attribut requis */ { #ifndef NODISPLAY MandatoryAttrOK = FALSE; do { /* demande a l'utilisateur d'entrer une valeur */ /* pour l'attribut */ if (pAttr->AeAttrType == AtReferenceAttr) /* demande a l'utilisateur l'element reference' */ MandatoryAttrOK = LinkReference (pEl, pAttr, pDoc); else { if (ThotLocalActions[T_attrreq] != NULL) (*(Proc3)ThotLocalActions[T_attrreq]) ( (void *)pAttr, (void *)pDoc, (void *)pEl); else switch (pAttr->AeAttrType) { case AtNumAttr: /* attribut a valeur numerique */ pAttr->AeAttrValue = 0; break; case AtTextAttr: /* attribut a valeur textuelle */ CopyStringToBuffer ((unsigned char *)" ", pAttr->AeAttrText, &len); break; case AtEnumAttr: /* attribut a valeurs enumerees */ pAttr->AeAttrValue = 1; break; default: break; } MandatoryAttrOK = TRUE; } } while (!MandatoryAttrOK && pDoc->DocSSchema != NULL); #endif /* NODISPLAY */ if (MandatoryAttrOK && pDoc->DocSSchema != NULL) { /* envoie l'evenement AttrModify.Post */ notifyAttr.event = TteAttrModify; notifyAttr.document = (Document) IdentDocument (pDoc); notifyAttr.element = (Element) pEl; notifyAttr.info = 0; /* not sent by undo */ notifyAttr.attribute = (Attribute) pAttr; notifyAttr.attributeType.AttrSSchema = (SSchema) pSS; notifyAttr.attributeType.AttrTypeNum = att; CallEventAttribute (¬ifyAttr, FALSE); } } if (pDoc->DocSSchema) { /* envoie l'evenement AttrCreate.Post */ notifyAttr.event = TteAttrCreate; notifyAttr.document = (Document) IdentDocument (pDoc); notifyAttr.element = (Element) pEl; notifyAttr.info = 0; /* not sent by undo */ notifyAttr.attribute = (Attribute) pAttr; notifyAttr.attributeType.AttrSSchema = (SSchema) pSS; notifyAttr.attributeType.AttrTypeNum = att; CallEventAttribute (¬ifyAttr, FALSE); } } } }
Animatable* CellTex::SubAnim(int i) { return GetReference(i); }
IParamBlock2* plClothingMtl::GetParamBlock(int i) { return (IParamBlock2*)GetReference(i); }
void SectorZone::UpdateSector() { sector_start = GeoVector(GetRadius(), start_radial).EndPoint(GetReference()); sector_end = GeoVector(GetRadius(), end_radial).EndPoint(GetReference()); }
ObservationZonePoint *Clone() const { return Clone(GetReference()); }
void BundleHooks::FilterBundleEventReceivers( const BundleEvent& evt, ServiceListeners::BundleListenerMap& bundleListeners) { std::vector<ServiceRegistrationBase> eventHooks; coreCtx->services.Get(us_service_interface_iid<BundleEventHook>(), eventHooks); { auto l = coreCtx->listeners.bundleListenerMap.Lock(); US_UNUSED(l); bundleListeners = coreCtx->listeners.bundleListenerMap.value; } if (!eventHooks.empty()) { std::vector<BundleContext> bundleContexts; for (auto& le : bundleListeners) { bundleContexts.push_back(MakeBundleContext(le.first->shared_from_this())); } std::sort(bundleContexts.begin(), bundleContexts.end()); bundleContexts.erase( std::unique(bundleContexts.begin(), bundleContexts.end()), bundleContexts.end()); const std::size_t unfilteredSize = bundleContexts.size(); ShrinkableVector<BundleContext> filtered(bundleContexts); std::sort(eventHooks.begin(), eventHooks.end()); for (auto iter = eventHooks.rbegin(), iterEnd = eventHooks.rend(); iter != iterEnd; ++iter) { ServiceReference<BundleEventHook> sr; try { sr = iter->GetReference(); } catch (const std::logic_error&) { std::string message("Failed to get event hook service reference"); coreCtx->listeners.SendFrameworkEvent( FrameworkEvent(FrameworkEvent::Type::FRAMEWORK_WARNING, GetBundleContext().GetBundle(), message, std::current_exception())); continue; } std::shared_ptr<BundleEventHook> eh = std::static_pointer_cast<BundleEventHook>(sr.d.load()->GetService( GetPrivate(GetBundleContext().GetBundle()).get())); if (eh) { try { eh->Event(evt, filtered); } catch (...) { std::string message("Failed to call Bundle EventHook # " + sr.GetProperty(Constants::SERVICE_ID).ToString()); coreCtx->listeners.SendFrameworkEvent( FrameworkEvent(FrameworkEvent::Type::FRAMEWORK_WARNING, GetBundleContext().GetBundle(), message, std::current_exception())); } } } if (unfilteredSize != bundleContexts.size()) { for (ServiceListeners::BundleListenerMap::iterator le = bundleListeners.begin(); le != bundleListeners.end();) { if (std::find_if(bundleContexts.begin(), bundleContexts.end(), [&le](const BundleContext& bc) { return GetPrivate(bc) == le->first; }) == bundleContexts.end()) { bundleListeners.erase(le++); } else { ++le; } } } } }
static picture_t *FilterPacked( filter_t *p_filter, picture_t *p_pic ) { picture_t *p_outpic; filter_sys_t *p_sys = p_filter->p_sys; int i_simthres = atomic_load( &p_sys->i_simthres ); int i_satthres = atomic_load( &p_sys->i_satthres ); int i_color = atomic_load( &p_sys->i_color ); if( !p_pic ) return NULL; p_outpic = filter_NewPicture( p_filter ); if( !p_outpic ) { picture_Release( p_pic ); return NULL; } int i_y_offset, i_u_offset, i_v_offset; int i_ret = GetPackedYuvOffsets( p_filter->fmt_in.video.i_chroma, &i_y_offset, &i_u_offset, &i_v_offset ); if( i_ret == VLC_EGENERIC ) { picture_Release( p_pic ); return NULL; } /* * Copy Y and do the U and V planes */ int refu, refv, reflength; GetReference( &refu, &refv, &reflength, i_color ); for( int y = 0; y < p_pic->p->i_visible_lines; y++ ) { uint8_t *p_src = &p_pic->p->p_pixels[y * p_pic->p->i_pitch]; uint8_t *p_dst = &p_outpic->p->p_pixels[y * p_outpic->p->i_pitch]; for( int x = 0; x < p_pic->p->i_visible_pitch / 4; x++ ) { p_dst[i_y_offset + 0] = p_src[i_y_offset + 0]; p_dst[i_y_offset + 2] = p_src[i_y_offset + 2]; if( IsSimilar( p_src[i_u_offset] - 0x80, p_src[i_v_offset] - 0x80, refu, refv, reflength, i_satthres, i_simthres ) ) { p_dst[i_u_offset] = p_src[i_u_offset]; p_dst[i_v_offset] = p_src[i_v_offset]; } else { p_dst[i_u_offset] = 0x80; p_dst[i_v_offset] = 0x80; } p_dst += 4; p_src += 4; } } return CopyInfoAndRelease( p_outpic, p_pic ); }
IParamBlock2* plPassMtl::GetParamBlock(int i) { return (IParamBlock2*)GetReference(i); }
bool ObservationZonePoint::Equals(const ObservationZonePoint &other) const { return shape == other.shape && GetReference().Equals(other.GetReference()); }