/// <summary> /// Creates a building highlight and adds it to the WrldMap. /// </summary> /// <param name="buildingHighlightOptions">The BuildingHighlightOptions object specifying how to create the BuildingHighlight object.</param> /// <returns>The new BuildingHighlight object</returns> public BuildingHighlight CreateHighlight(BuildingHighlightOptions buildingHighlightOptions) { var createParamsInterop = new BuildingHighlightCreateParamsInterop { SelectionMode = buildingHighlightOptions.GetSelectionMode(), Location = buildingHighlightOptions.GetSelectionLocation().ToLatLongInterop(), ScreenPoint = CameraHelpers.ScreenPointOriginTopLeft(buildingHighlightOptions.GetSelectionScreenPoint()), HighlightColor = buildingHighlightOptions.GetColor().ToColorInterop(), ShouldCreateView = !buildingHighlightOptions.IsInformationOnly() }; var highlightId = NativeBuildingsApi_CreateHighlight(NativePluginRunner.API, ref createParamsInterop); m_materialRepository.CreateAndAddHighlightMaterial(MakeMaterialId(highlightId), buildingHighlightOptions.GetColor()); var buildingHighlight = new BuildingHighlight( this, highlightId, buildingHighlightOptions.GetColor(), buildingHighlightOptions.IsInformationOnly(), buildingHighlightOptions.GetBuildingInformationReceivedHandler()); m_buildingHighlightIdToObject.Add(highlightId, buildingHighlight); var buildingInformation = TryFetchBuildingInformationForHighlight(buildingHighlight.Id); if (buildingInformation != null) { buildingHighlight.SetBuildingInformation(buildingInformation); } return(buildingHighlight); }
public void DestroyHighlight(BuildingHighlight buildingHighlight) { if (!m_buildingHighlightIdToObject.ContainsKey(buildingHighlight.Id)) { return; } m_buildingHighlightIdToObject.Remove(buildingHighlight.Id); NativeBuildingsApi_DestroyHighlight(NativePluginRunner.API, buildingHighlight.Id); m_materialRepository.ReleaseHighlightMaterial(MakeMaterialId(buildingHighlight.Id)); }
public void SetHighlightColor(BuildingHighlight buildingHighlight, Color color) { var buildingHighlightId = buildingHighlight.Id; if (!m_buildingHighlightIdToObject.ContainsKey(buildingHighlightId)) { return; } var colorInterop = color.ToColorInterop(); NativeBuildingsApi_SetHighlightStyleAttributes(NativePluginRunner.API, buildingHighlightId, ref colorInterop); // currently bypasses platform round-trip m_materialRepository.SetHighlightMaterialColor(HighlightMaterialPrefix + buildingHighlightId, color); }