File: MyImageListItem.h

package info (click to toggle)
lynkeos.app 3.1%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 15,740 kB
  • sloc: objc: 36,412; ansic: 684; cpp: 148; sh: 68; makefile: 21
file content (219 lines) | stat: -rw-r--r-- 6,110 bytes parent folder | download
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
//
//  Lynkeos
//  $Id: MyImageListItem.h 585 2018-09-08 21:30:37Z j-etienne $
//
//  Created by Jean-Etienne LAMIAUD on Tue Sep 30 2003.
//  Copyright (c) 2003-2014. Jean-Etienne LAMIAUD
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
// 

/*!
 * @header
 * @abstract Image list item classes
 */
#ifndef __MYIMAGELISTITEM_H
#define __MYIMAGELISTITEM_H

#import <Foundation/Foundation.h>

#ifdef GNUSTEP
#import "LynkeosCommon.h"
#import <AppKit/NSImage.h>
#endif

#include "LynkeosFileReader.h"

#include "LynkeosCommon.h"
#include "processing_core.h"
#include "LynkeosProcessableImage.h"

/** Access to processing parameters related only to the item */
extern NSString * const myImageListItemRef;
/* Predefined keys for calibration frames */
extern NSString * const myImageListItemDarkFrame;   ///< Dark frame param key
extern NSString * const myImageListItemFlatField;   ///< Flat field param key

/*!
 * @abstract Common class for all image list items
 * @discussion It provides a unique interface to the outline view, and the 
 *    common data and methods for the image list items.
 * @ingroup Models
 */
@interface MyImageListItem : LynkeosProcessableImage <LynkeosProcessingParameter>
{
@protected
   //!< The associated file reader
   id <LynkeosImageFileReader,LynkeosMovieFileReader> _reader;
   BOOL             _isCustomReader;  //!< Whether the reader uses custom images
   NSURL*           _itemURL;             //!< Image or movie URL
   NSString*        _itemName;            //!< To be displayed to user
   NSMutableArray*  _childList;           //!< Array of childs, if any
   MyImageListItem* _parent;              //!< Parent item, if any
   NSUInteger       _index;               //!< Our index, if any
   //! Current selection state, can be tri state
   int              _selection_state;

   id <LynkeosImageBuffer> _flat;         //!< Cached flat field
   id <LynkeosImageBuffer> _dark;         //!< Cached dark frame

   //! Strategy for processing the image
   ImageOperatorsStrategy_t _processStrategy;
}

/*!
 * @method initWithURL:
 * @abstract Initialization
 * @param url Image or movie associated with this item.
 */
- (id) initWithURL :(NSURL*)url;

/*!
 * @abstract Change the strategy for processing
 * @discussion The items are always created with the standard strategy (no parallelization).
 * @param strategy The new strategy
 */
- (void) setOperatorsStrategy:(ImageOperatorsStrategy_t)strategy ;

/// \name Read
/// Read accessors to the class attributes
//@{
/*!
 * @method getURL
 * @abstract Read the URL of the associated file
 * @result The URL
 */
- (NSURL*) getURL ;

/*!
 * @method getSelectionState
 * @abstract Read the item current selection state
 * @result Tristate selection state.
 */
- (int) getSelectionState;

/*!
 * @method selectionState
 * @abstract Get the item current selection state as a NSNumber
 * @result Tristate selection state in a NSNumber
 */
- (NSNumber*) selectionState;

/*!
 * @abstract Read the name of the associated file
 * @result The name
 */
- (NSString*)name;

/*!
 * @abstract Read the movie image index (nil if not in a movie)
 * @result The index or nil
 */
- (NSNumber*) index;

/*!
 * @method getParent
 * @abstract Get the parent item if there is one
 * @result The parent item or nil
 */
- (MyImageListItem*) getParent;

/*!
 * @method numberOfChildren
 * @abstract Return the number of children, 0 for leaf items.
 * @result Number of children.
 */
- (u_long) numberOfChildren ;

/*!
 * @method getChildAtIndex:
 * @abstract Get the asked item
 * @param index The index of item to get.
 * @result The child item.
 */
- (MyImageListItem*) getChildAtIndex:(u_long)index ;

/*!
 * @method indexOfItem:
 * @abstract Get the index of the given item in the child list (different from 
 *   the item index which is the index of its frame in the movie)
 * @param item The item which index we need
 * @result The index
 */
- (NSUInteger) indexOfItem :(MyImageListItem*)item ;

/*!
 * @method getReader
 * @abstract Get the file reader for that item.
 * @result The file reader associated with this item.
 */
- (id <LynkeosFileReader>) getReader;
//@}

/// \name Write
/// Write accessors to the class attributes
//@{
/*!
 * @method addChild:
 * @abstract Add the given child in the children list
 * @param item The item to add
 */
- (void) addChild:(MyImageListItem*)item ;

   /*!
 * @method deleteChild:
 * @abstract Delete the given child from the children list
 * @param item The item to delete
 */
- (void) deleteChild:(MyImageListItem*)item ;

/*!
 * @method setSelected:
 * @abstract Set the selection state (no tristate)
 * @param value The new selection state
 */
- (void) setSelected :(BOOL)value;

/*!
 * @abstract Set the parent object for parameters chain
 * @param parent The parent of this item in the parameter chain
 */
- (void) setParametersParent :(LynkeosProcessingParameterMgr*)parent;
//@}

/*!
 * @abstract Set the mode (image, dark frame, flat field) of the container list
 * @param mode The item mode
 */
- (void) setMode:(ListMode_t)mode ;

/*!
 * @method imageListItemWithURL:
 * @abstract Creator
 * @param url The URL from which the item shall be created.
 * @result The allocated and intialized item.
 */
+ (id) imageListItemWithURL :(NSURL*)url;

/*!
 * @method imageListItemFileTypes
 * @abstract File types and subclasses registering
 * @result The file types array.
 */
+ (NSArray*) imageListItemFileTypes ;

@end

#endif