Example #1
0
def OpenProbeScanner(*_):
    from eve.client.script.ui.inflight.scanner import Scanner
    wnd = Scanner.GetIfOpen()
    if wnd is None:
        wnd = Scanner.Open()
    blue.pyos.synchro.Yield()
    wnd.SelectProbeScanner()
    sm.GetService('viewState').ActivateView('systemmap')
    wnd.LaunchFormation(formations.PINPOINT_FORMATION, 4)
Example #2
0
def OpenProbeScanner(*_):
    from eve.client.script.ui.inflight.scanner import Scanner
    wnd = Scanner.GetIfOpen()
    if wnd is None:
        wnd = Scanner.Open()
    blue.pyos.synchro.Yield()
    wnd.SelectProbeScanner()
    OpenSolarSystemMap()
    wnd.LaunchFormation(formations.PINPOINT_FORMATION, 4)
    def TryPickSphereBorder(self):
        matches = []
        scannerWnd = Scanner.GetIfOpen()
        if scannerWnd:
            x, y = uicore.ScaleDpi(uicore.uilib.x), uicore.ScaleDpi(uicore.uilib.y)
            ray, start = GetRayAndPointFromScreen(x, y)
            pickRadiusRay, pickRadiusStart = GetRayAndPointFromScreen(x - 30, y)
            camera = sm.GetService('sceneManager').GetRegisteredCamera('systemmap')
            if camera is None:
                return
            viewDir = geo2.QuaternionTransformVector(camera.rotationAroundParent, (0.0, 0.0, 1.0))
            viewDir = geo2.Vec3Normalize(viewDir)
            targetPlaneNormal = geo2.Vector(*viewDir)
            scanSvc = sm.StartService('scanSvc')
            probeData = scanSvc.GetProbeData()
            probes = scannerWnd.GetProbeSpheres()
            for probeID, probeControl in probes.iteritems():
                if probeID not in probeData or probeData[probeID].state != const.probeStateIdle:
                    continue
                targetPlanePos = geo2.Vector(probeControl.locator.worldTransform[3][0], probeControl.locator.worldTransform[3][1], probeControl.locator.worldTransform[3][2])
                rad = list(probeControl.sphere.scaling)[0] * SYSTEMMAP_SCALE
                pos = RayToPlaneIntersection(start, ray, targetPlanePos, targetPlaneNormal)
                picRadiusPos = RayToPlaneIntersection(pickRadiusStart, pickRadiusRay, targetPlanePos, targetPlaneNormal)
                pickRad = (trinity.TriVector(*picRadiusPos) - trinity.TriVector(*pos)).Length()
                diffFromPickToSphereBorder = (trinity.TriVector(*targetPlanePos) - trinity.TriVector(*pos)).Length()
                if rad + pickRad > diffFromPickToSphereBorder > rad - pickRad:
                    matches.append((abs(rad - diffFromPickToSphereBorder), probeControl))

        if matches:
            matches = uiutil.SortListOfTuples(matches)
            return matches[0]
 def OnMouseDown(self, button):
     systemmap = sm.GetService('systemmap')
     self._isPicked = True
     uiutil.SetOrder(self, 0)
     systemmap.CollapseBubbles()
     systemmap.SortBubbles()
     scannerWnd = Scanner.GetIfOpen()
     picktype, pickobject = self.GetPick()
     if uicore.uilib.leftbtn and pickobject:
         if pickobject.name[:6] == 'cursor':
             cursorName, side, probeID = pickobject.name.split('_')
             if probeID:
                 sm.GetService('scanSvc').StartMoveMode()
                 probe = scannerWnd.GetControl(probeID)
                 if probe:
                     cursorAxis = cursorName[6:]
                     x = uicore.ScaleDpi(uicore.uilib.x)
                     y = uicore.ScaleDpi(uicore.uilib.y)
                     self.PickAxis(x, y, probe, cursorAxis.lower())
                     if scannerWnd:
                         scannerWnd.HighlightProbeIntersections()
                     return
     if scannerWnd and button == 0:
         pickedProbeControl = self.TryPickSphereBorder()
         if pickedProbeControl:
             self.sr.rangeProbe = pickedProbeControl
             pickedProbeControl.ShowScanRanges()
             uicore.uilib.SetCursor(uiconst.UICURSOR_DRAGGABLE)
             scannerWnd.StartScaleMode(self.GetDotInCameraAlignedPlaneFromProbe(pickedProbeControl))
         else:
             uicore.uilib.SetCursor(uiconst.UICURSOR_SELECTDOWN)
Example #5
0
def OpenProbeScanner():
    if IsBetaScannersEnabled():
        from eve.client.script.ui.inflight.probeScannerWindow import ProbeScannerWindow
        ProbeScannerWindow.Open()
    else:
        from eve.client.script.ui.inflight.scanner import Scanner
        Scanner.Open()
Example #6
0
    def ScaleProbesAroundCenter(self):
        x, y = uicore.ScaleDpi(uicore.uilib.x), uicore.ScaleDpi(uicore.uilib.y)
        mousePos = geo2.Vector(x, y, 0)
        probeData = sm.GetService('scanSvc').GetProbeData()
        scannerWnd = Scanner.GetIfOpen()
        if scannerWnd is None:
            return
        probes = scannerWnd.GetProbeSpheres()
        centroid = geo2.Vector(0, 0, 0)
        numProbes = 0
        for probeID, probeControl in probes.iteritems():
            if probeID not in probeData or probeData[
                    probeID].state != const.probeStateIdle:
                continue
            probePos = probeControl.GetWorldPosition()
            centroid += probePos
            numProbes += 1

        if numProbes <= 1:
            return
        centroid /= numProbes
        projectionParams = GetWorldToScreenParameters()
        centroidTansform = ((SYSTEMMAP_SCALE, 0, 0,
                             0), (0, SYSTEMMAP_SCALE, 0,
                                  0), (0, 0, SYSTEMMAP_SCALE, 0),
                            (centroid.x, centroid.y, centroid.z, 1.0))
        screenCentroid = geo2.Vector(
            *ProjectTransform(projectionParams, centroidTansform))
        screenCentroid.z = 0
        probeScreenPos = geo2.Vector(*ProjectTransform(
            projectionParams, self.sr.movingProbe.locator.worldTransform))
        probeScreenPos.z = 0
        centerToProbe = probeScreenPos - screenCentroid
        centerToProbeLength = geo2.Vec2Length(centerToProbe)
        if centerToProbeLength < 0.1:
            return
        centerToProbeNormal = centerToProbe / centerToProbeLength
        toMouseDotProduct = geo2.Vec2Dot(mousePos - screenCentroid,
                                         centerToProbeNormal)
        projectedPos = screenCentroid + toMouseDotProduct * centerToProbeNormal
        toProjectedLength = geo2.Vec2Length(projectedPos - screenCentroid)
        if toProjectedLength < 0.1:
            return
        moveScale = toProjectedLength / centerToProbeLength
        if toMouseDotProduct < 0:
            moveScale = -moveScale
        for probeID, probeControl in probes.iteritems():
            if probeID not in probeData or probeData[
                    probeID].state != const.probeStateIdle:
                continue
            pos = probeControl.GetWorldPosition()
            toProbe = pos - centroid
            endPos = centroid + toProbe * moveScale
            endPos = (endPos.x / SYSTEMMAP_SCALE, endPos.y / SYSTEMMAP_SCALE,
                      endPos.z / SYSTEMMAP_SCALE)
            probeControl.SetPosition(endPos)

        scannerWnd.ShowCentroidLines()
        scannerWnd.HighlightProbeIntersections()
        sm.GetService('systemmap').HighlightItemsWithinProbeRange()
 def ShowGrid(self):
     XZ = bool(self.activeManipAxis == 'xz')
     YZ = bool(self.activeManipAxis == 'yz')
     XY = bool(self.activeManipAxis == 'xy')
     if self.sr.movingProbe and (XZ or YZ or XY):
         scannerWnd = Scanner.GetIfOpen()
         if scannerWnd:
             scannerWnd.ShowDistanceRings(self.sr.movingProbe, self.activeManipAxis)
Example #8
0
 def ScaleActiveProbe(self, *args):
     if self.sr.rangeProbe:
         scannerWnd = Scanner.GetIfOpen()
         if scannerWnd:
             scannerWnd.ScaleProbe(
                 self.sr.rangeProbe,
                 self.GetDotInCameraAlignedPlaneFromProbe(
                     self.sr.rangeProbe))
 def HighlightBorderOfProbe(self, probeControl = None):
     scannerWnd = Scanner.GetIfOpen()
     if scannerWnd:
         probes = scannerWnd.GetProbeSpheres()
         for _probeID, _probeControl in probes.iteritems():
             if probeControl and _probeControl == probeControl:
                 probeControl.HighlightBorder(True)
             else:
                 _probeControl.HighlightBorder(False)
Example #10
0
 def MoveActiveProbe(self, x, y):
     if self.activeManipAxis and self.targetPlaneNormal and self.sr.movingProbe:
         ray, start = GetRayAndPointFromScreen(x, y)
         diff = self._DiffProjectedPoint(ray, start)
         scannerWnd = Scanner.GetIfOpen()
         if scannerWnd:
             diff = geo2.Vector(*diff)
             diff *= 1.0 / SYSTEMMAP_SCALE
             scannerWnd.MoveProbe(self.sr.movingProbe, diff)
             scannerWnd.ShowCentroidLines()
Example #11
0
 def OnMouseUp(self, button):
     if not uicore.cmd.IsUIHidden():
         uicore.layer.main.state = uiconst.UI_PICKCHILDREN
     if not (uicore.uilib.leftbtn or uicore.uilib.rightbtn):
         self._isPicked = False
     if button == 1:
         if uicore.uilib.leftbtn and (self.sr.movingProbe
                                      or self.sr.rangeProbe):
             scannerWnd = Scanner.GetIfOpen()
             if scannerWnd:
                 scannerWnd.CancelProbeMoveOrScaling()
                 if self.sr.movingProbe:
                     self.sr.movingProbe.ShowIntersection()
                 self.sr.movingProbe = None
                 self.sr.rangeProbe = None
                 scannerWnd.lastScaleUpdate = None
                 scannerWnd.lastMoveUpdate = None
         uthread.new(self.TryToHilight)
         uiutil.SetOrder(self, -1)
         return
     uiutil.SetOrder(self, -1)
     scannerWnd = Scanner.GetIfOpen()
     if scannerWnd:
         if self.sr.rangeProbe:
             uthread.new(scannerWnd.RegisterProbeRange, self.sr.rangeProbe)
         if self.sr.movingProbe:
             uthread.new(scannerWnd.RegisterProbeMove, self.sr.movingProbe)
         scannerWnd = scannerWnd.StopScaleMode()
     if scannerWnd and self.sr.rangeProbe:
         uthread.new(scannerWnd.RegisterProbeRange, self.sr.rangeProbe)
     if scannerWnd and self.sr.movingProbe:
         uthread.new(scannerWnd.RegisterProbeMove, self.sr.movingProbe)
     self.sr.rangeProbe = None
     if self.sr.movingProbe:
         self.sr.movingProbe.ShowIntersection()
     self.sr.movingProbe = None
     if scannerWnd:
         scannerWnd.HideDistanceRings()
     uthread.new(self.TryToHilight)
     sm.GetService('systemmap').SortBubbles()
     sm.GetService('ui').ForceCursorUpdate()
 def MoveActiveProbe(self, x, y):
     """
         Transform the axis of the tool in world coordinates from screen space.
     """
     if self.activeManipAxis and self.targetPlaneNormal and self.sr.movingProbe:
         ray, start = GetRayAndPointFromScreen(x, y)
         diff = self._DiffProjectedPoint(ray, start)
         scannerWnd = Scanner.GetIfOpen()
         if scannerWnd:
             diff = geo2.Vector(*diff)
             diff *= 1.0 / SYSTEMMAP_SCALE
             scannerWnd.MoveProbe(self.sr.movingProbe, diff)
             scannerWnd.ShowCentroidLines()
Example #13
0
 def TryToHilight(self):
     if getattr(self, '_tryToHilight_Busy', None):
         self._tryToHilight_Pending = True
         return
     if self.destroyed:
         return
     self._tryToHilight_Busy = True
     picktype, pickobject = self.GetPick()
     if pickobject and hasattr(pickobject,
                               'name') and pickobject.name[:6] == 'cursor':
         scannerWnd = Scanner.GetIfOpen()
         if scannerWnd:
             scannerWnd.HiliteCursor(pickobject)
         self.HighlightBorderOfProbe()
         if uicore.uilib.mouseOver == self:
             uicore.uilib.SetCursor(uiconst.UICURSOR_SELECTDOWN)
     else:
         scannerWnd = Scanner.GetIfOpen()
         if scannerWnd:
             scannerWnd.HiliteCursor()
         pickedProbeControl = self.TryPickSphereBorder()
         blue.pyos.synchro.SleepWallclock(100)
         if self.destroyed:
             return
         _pickedProbeControl = self.TryPickSphereBorder()
         if _pickedProbeControl and _pickedProbeControl == pickedProbeControl:
             self.HighlightBorderOfProbe(pickedProbeControl)
             uicore.uilib.SetCursor(uiconst.UICURSOR_DRAGGABLE)
         else:
             self.HighlightBorderOfProbe()
             if uicore.uilib.mouseOver == self:
                 uicore.uilib.SetCursor(uiconst.UICURSOR_SELECTDOWN)
     if self.destroyed:
         return
     self._tryToHilight_Busy = False
     if getattr(self, '_tryToHilight_Pending', None):
         self._tryToHilight_Pending = False
         self.TryToHilight()
Example #14
0
 def ClickLink(self, action):
     if action == 'ShowAnomalies':
         self.ShowAnomalies()
     elif action == 'HideAnomalies':
         self.StopShowingAnomalies()
     elif action == 'ClearFiltered':
         self.SetActiveFilter(0)
     elif action == 'ClearIgnored':
         self.scanHandler.ClearIgnoredResults()
     else:
         raise RuntimeError('scanSvc::ClickLink - Not supported action (%s)' % action)
     wnd = Scanner.GetIfOpen()
     if wnd is not None:
         wnd.LoadFilterOptionsAndResults()
Example #15
0
 def OnSessionChanged(self, isRemote, session, change):
     if 'solarsystemid' in change or 'shipid' in change:
         self.FlushScannerState(reinjectSites='solarsystemid' not in change)
         scanner = Scanner.GetIfOpen()
         if scanner:
             scanner.LoadResultList()
def OpenProbeScanner():
    from eve.client.script.ui.inflight.scanner import Scanner
    wnd = Scanner.Open()