/// <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);
        }
Example #2
0
        public bool TryFetchScreenPointForPositioner(Positioner positioner, out Vector3 screenPoint)
        {
            screenPoint = Vector3.zero;

            if (NativePositionerApi_TryFetchScreenPointForPositioner(NativePluginRunner.API, positioner.Id, out screenPoint))
            {
                screenPoint = CameraHelpers.ScreenPointOriginTopLeft(screenPoint);
                return(true);
            }

            return(false);
        }