This file is indexed.

/usr/share/vtk/GUI/Cocoa/MyDocument.mm is in vtk-examples 5.8.0-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#import "MyDocument.h"

#import "BasicVTKView.h"

#import "vtkInteractorStyleSwitch.h"
#import "vtkCocoaRenderWindowInteractor.h"
#import "vtkConeSource.h"
#import "vtkCylinderSource.h"
#import "vtkPolyDataMapper.h"
#import "vtkSmartPointer.h"
#import "vtkDebugLeaks.h"

@implementation MyDocument

- (void)setupLeftVTKView
{
    [leftVTKView initializeVTKSupport];

    // 'smart pointers' are used because they are very similiar to creating auto-realeased objects in Cocoa.

    // Personal Taste Section. I like to use a trackball interactor
    vtkSmartPointer<vtkInteractorStyleSwitch>   intStyle = vtkSmartPointer<vtkInteractorStyleSwitch>::New();
    intStyle->SetCurrentStyleToTrackballCamera();
    [leftVTKView getInteractor]->SetInteractorStyle(intStyle);

    // Create a cone, see the "VTK User's Guide" for details
    vtkSmartPointer<vtkConeSource> cone = vtkSmartPointer<vtkConeSource>::New();
        cone->SetHeight(3.0);
        cone->SetRadius(1.0);
        cone->SetResolution(100);
    vtkSmartPointer<vtkPolyDataMapper>  coneMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
        coneMapper->SetInput(cone->GetOutput());
    vtkSmartPointer<vtkActor>   coneActor = vtkSmartPointer<vtkActor>::New();
        coneActor->SetMapper(coneMapper);
    [leftVTKView getRenderer]->AddActor(coneActor);

    // Tell the system that the view needs to be redrawn
    [leftVTKView setNeedsDisplay:YES];
}

- (void)setupRightVTKView
{
    [rightVTKView initializeVTKSupport];

    // 'smart pointers' are used because they are very similiar to creating auto-realeased objects in Cocoa.

    // Personal Taste Section. I like to use a trackball interactor
    vtkSmartPointer<vtkInteractorStyleSwitch>   intStyle = vtkSmartPointer<vtkInteractorStyleSwitch>::New();
    intStyle->SetCurrentStyleToTrackballCamera();
    [rightVTKView getInteractor]->SetInteractorStyle(intStyle);

    // Create a cyclinder, see the "VTK User's Guide" for details
    vtkSmartPointer<vtkCylinderSource>  cylinder = vtkSmartPointer<vtkCylinderSource>::New();
        cylinder->SetResolution(100);
    vtkSmartPointer<vtkPolyDataMapper>  cylinderMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
        cylinderMapper->SetInput(cylinder->GetOutput());
    vtkSmartPointer<vtkActor>   cylinderActor = vtkSmartPointer<vtkActor>::New();
        cylinderActor->SetMapper(cylinderMapper);
    [rightVTKView getRenderer]->AddActor(cylinderActor);

    // Tell the system that the view needs to be redrawn
    [rightVTKView setNeedsDisplay:YES];
}

#pragma mark -

- (id)init 
{
    self = [super init];
    if (self != nil) {
        // Add your subclass-specific initialization here.
        // If an error occurs here, send a [self release] message and return nil.
    }
    return self;
}

- (void)close
{
    [super close];

    // Releases memory allocated in initializeVTKSupport.
    // In a way, calling these is pointless since the application is quitting anyway.
    [leftVTKView cleanUpVTKSupport];
    [rightVTKView cleanUpVTKSupport];

    // If you have built vtk with VTK_DEBUG_LEAKS on then this method will print out any leaks
    // that exist.  The sample has been careful to cleanup after itself, so there should be no leaks.
    vtkDebugLeaks::PrintCurrentLeaks();
}

- (NSString *)windowNibName
{
    // Override returning the nib file name of the document
    // If you need to use a subclass of NSWindowController or if your document supports multiple NSWindowControllers, you should remove this method and override -makeWindowControllers instead.
    return @"MyDocument";
}

- (void)windowControllerDidLoadNib:(NSWindowController *)windowController
{
    [super windowControllerDidLoadNib:windowController];

    // vtk stuff
    [self setupLeftVTKView];
    [self setupRightVTKView];
}


- (NSData *)dataRepresentationOfType:(NSString *)aType
{
    // Insert code here to write your document from the given data.  You can also choose to override -fileWrapperRepresentationOfType: or -writeToFile:ofType: instead.

    // For applications targeted for Tiger or later systems, you should use the new Tiger API -dataOfType:error:.  In this case you can also choose to override -writeToURL:ofType:error:, -fileWrapperOfType:error:, or -writeToURL:ofType:forSaveOperation:originalContentsURL:error: instead.

    return nil;
}

- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)aType
{
    // Insert code here to read your document from the given data.  You can also choose to override -loadFileWrapperRepresentation:ofType: or -readFromFile:ofType: instead.

    // For applications targeted for Tiger or later systems, you should use the new Tiger API readFromData:ofType:error:.  In this case you can also choose to override -readFromURL:ofType:error: or -readFromFileWrapper:ofType:error: instead.

    return YES;
}

@end